Learn how to solve all the levels of the Google's Blockly Maze (introduction to loops and conditionals).

How to solve (solution) Google's Blockly Future Programmers Game: Bird Level

Google's Blockly Games is a series of educational games that teach programming. It is based on the Blockly library. All code is free and open source. The Bird Game is a deep-dive into conditionals. Control-flow is explored with increasingly complex conditions. The game engine and source is available as an open source project at Github here.

In this article we'll share with you the solution to all 10 levels available in the Bird Game of Blockly.

Level #1

Google's Blockly Programmer Bird Game Level 1

The respective JavaScript code of this level is:

heading(45);

Level #2

Google's Blockly Bird Level 2

The respective JavaScript code of this level is:

if (noWorm()) {
    heading(0);
} else {
    heading(90);
}

Level #3

Google's Blockly Programmers Bird Level 3

The respective JavaScript code of this level is:

if (noWorm()) {
    heading(315);
} else {
    heading(45);
}

Level #4

Google's Blockly Programmers Bird Level 4

The respective JavaScript code of this level is:

if (getX() < 80) {
    heading(0);
} else {
    heading(270);
}

Level #5

Google's Blockly Game Bird Level 5

The respective JavaScript code of this level is:

if (getY() > 20) {
    heading(270);
} else {
    heading(180);
}

Level #6

Google's Blockly Programmers Bird Level 6

The respective JavaScript code of this level is:

if (noWorm()) {
    heading(345);
} else if (getY() < 80) {
    heading(90);
} else {
    heading(180);
}

Level #7

Google's Blockly Bird Game Level 7

The respective JavaScript code of this level is:

if (getY() > 50) {
   heading(225);
} else if (noWorm()) {
   heading(300);
} else {
   heading(180);
}

Level #8

Google's Blockly Bird Game Level 8

The respective JavaScript code of this level is:

if (getY() < 40) {
    heading(90);
} else if (noWorm()) {
    heading(345);
} else if (getX() > 50 && getY() < 50) {
    heading(180);
} else {
    heading(45);
}

Level #9

Google's Blockly Bird Game Level 9

The respective JavaScript code of this level is:

if (noWorm() && getX() > 20) {
    heading(180);
} else if (noWorm() && getY() > 20) {
    heading(270);
} else if (getY() < 70 && getX() < 40) {
    heading(90);
} else {
    heading(315);
}

Level #10

Google's Blockly Programmers Game Bird Level 10

The respective JavaScript code of this level is:

if (noWorm() && getY() < 80 && getX() < 30) {
    heading(90);
} else if (noWorm() && getX() < 80) {
    heading(0);
} else if (noWorm() && getY() > 50) {
    heading(270);
} else if (getY() < 80 && getX() > 20) {
    heading(90);
} else if (getX() > 20) {
    heading(180);
} else if (getY() > 20) {
    heading(270);
}

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors