The Astrophysical CodyMaze is a variation of the CodyMaze – created by Alessandro Bogliolo within CodeMOOC – developed by the National Institute for Astrophysics in collaboration with the University of Urbino and Digit srl. This is a virtual labyrinth in the real world which proposes challenges of coding and a quiz about astronomy, astrophysics and space exploration.

CodyMaze helps develop both computational thinking and problem-solving skills. At the same time, it allows students to revise the science programme,  while having fun. Both coding puzzles and quiz are addressed to pupils starting from the junior secondary school, and adult public. Also small children have fun in a virtual laboratory, but we suggest that they are accompanied in using the mobile phone, and supported in the execution of the programming instructions.

In this game, you move on a 5 x 5 chessboard, whose boxes contain QR codes. Apparently, the chessboard is free, but, thanks to the QR codes, it presents everchanging mazes, which are proposed to the player by the Telegram @codymazebot. The player moves physically on the chessboard, following the bot’s instructions, and scans the QR code which he/she reaches at each stop, to check whether he/she has correctly followed the sequence of instructions. During the various stages of the game, sequences of instructions of increasing complexity are proposed, which introduce all the basic concepts of programming. In order to receive the series of instructions leading to the next QR code, you must answer correctly to a quiz of astronomy, whose topic depends on the box of the labyrinth. For the astrophysical version of the game, we prepared 250 multiple-choice quiz of astronomy, therefore if you want to follow the labyrinth several times, it is very unlikely that the challenges proposed may be the same. At the end of the game, the Telegram bot issues a certificate of completion, which reports the list of  programming constructs, experimented during the game.


QR code distribution scheme.

CodyMaze is played upon a 5×5 square grid, on which 25 QR codes are arranged. The QR codes lay on the floor, at lest 50 cm from each other. In this way, the player can move with his/her boby inside the chessboard, without using pawns. If the chessboard were actually drawn on the ground, each QR code would occupy the centre of a box, but the presence of the QR codes, which identify the centre of the boxes makes it unnecessary to trace its edges. Therefore, the chessboarf cannot be drawn. The columns and the lines of the chessboard are identified by letters and numbers, starting from the top left corner. Each QR code is assigned a position, identified by a letter and a number. Moreover, the chessboard is conventionally oriented so that the upper side corresponds to the North and, as a consequence, the lower side to the South, the left one to the west and the right one to the East. If the location allows it, we suggest that the chessboard be oriented in coherence with the cardinal points.

You can download the 25 QR printable codes of the Astrophysical CodyMaze at the following links:

To facilitate their arrangement and use, each QR code reports both position and cardinal points. Five QR codes have stars, which affect the execution of some instructions.

Objective of the Game

Get out of the virtual labyrinth, following the instructions provided by the @codymazebot.


The game can have one or more players. The limit to the number of players is only given by the dimensions of the chessboard on which players should move independently, each one following the instructions provided by @codymazebot.


In order to play, you need:

  • Smartphone or tablet with:
  • The number of devices must be the same as the number of players who play at the same time. At the end of the game, the same smartphone can be used by another player, to whom the bot will present a different path.


  • The player does not know the path; he/she receives instructions from the Telegram bot, and must interpret and perform them correctly.
  • The sequences of instructions provided by the bot are increasingly difficult, both for the constructs they introduce, and for their length.

Game Play

The player interacts with the game by performing the following actions:

  • Scan the QR code associated to the box in which the player is (frame with a bar-code reader the QR code you want to scan, select Telegram messenger as application with which you open the link contained in the QR code, press  START that appears below in the interface of the Telegram bot)
  • Astronomy Quiz (answer correctly to the multiple-choice quiz proposed by the bot)
  • Setting the direction (set one of the four buttons: North, East, South, or West when requested by the bot)
  • Reading and interpreting the instructions provided by the bot (the syntax is described in the section – “game design”)
  • Executing the instructions provided by the bot (the instructions are executed physically, moving on the chessboard on the ground).

Game Design (rules)

Starting the game

  1. You can start a new game only after having finished other games, possibly in progress.
  2. If @codymazebot is not ready to start a new game, because the preceding one was interrupted, you can return it to its start with the command /reset.
  3. In these conditions, the game is started when any of the QR codes of the grid is scanned.
  4. In order to start the game, the player should choose an external box (one of the 16 which compose the frame) and scan the corresponding QR code to notify your choice to the bot.
  5. The bot shows the player the direction and asks for confirmation. It is important to respect this indication: each successive instruction must be followed starting from the chosen position, and from the direction indicated by the bot.
  6. The bot proposes a multiple-choice quiz about astronomy. Each box of the labyrinth is characterized by a different topic. In order to proceed along the labyrinth, you must answer correctly.


  1. At each step, the bot leads the player with a code, preceded by this sentence: “Follow these indications so as to solve your next step and scan the QR code as you get there“. The code follows the syntax described in the following, in the section Syntax.
  2. The player must move on the chessboard, ececuting the code as if he/she were a robot, paying attention to the position and direction of the start.
  3. Once finished the execution, the playes scan the QR code to notify to the bot the position he/she has reached.
  4. The bot answers by asking “Which way are you looking?”  and introducing 4 buttons for choosing the direction.
  5. The player indicates the direction (without turning with respect to the position taken at the end of the code)
  6. If he/she runs the code correctly, the bot say “Great! You found the right point ” and proposes the code for the next step.
  7. Attention: it may happen that a move involves no movement. In that case, the correct execution includes another scan of the QR code on which the player finds him/herself.

Wrong Moves

  1. A move is wrong if the wrong QR is scanned, or the wrong direction is set, in comparison with those foreseen by the code provided by the bot.
  2. After a wrong move, the bot asks the player to go back to the starting point of his/her last move, of which it provides coordinates and direction. The bot’s answer is: “Ops! You made a mistake! Go back to the position … looking towards … and scan the code once again”.
  3. The player must go back to the position indicated by the bot, scan the  QR code, look in the direction indicated by the bot, and select it to confirm when required.
  4. At this point, the bot provides once again the instructions, to repeat the move.

Completing the labyrinth

  1. At the end of the moves foreseen, the bot sends the following message: “Congratulations! You completed the CodyMaze!
  2. The bot then ask to enter the name you would like to have in the certificate of  completion. The message of request is the following: “Write name and surname to display in the certificate of completion:
  3. The player should type his/her name and surname (or any other name, as for example the name of the class, or a list of names, in case the game has been played by a team)
  4. The bot asks: “Do you confirm that the name you sent is …?” – so as to allow you to correct possible mistakes.
  5. If you answe Yes you will obtain the certificate of completion to your name. Over and above the name indicated by the player, the certificate contains a unique identification which may be used in the future to check whether the certificate is authentic. The certificate can be downloaded, saved and shared with pride!
  6. When the bot sends the message “Thanks for having played with CodyMaze!” it is ready to start a new game.


Elementary Instructions. The bot uses the 3 elementary instructions of CodyRoby, represented by the respective initials in small letters:

  • f = go ahead, moving from one QR cde to the next, along the direction of travel
  • l = turn left, rotating by 90 degrees counterclockwise, without changing box
  • r = turn right, rotating by 90 degreens clockwise, without changing box 

Repetitions. The bot asks to repeat more than an instruction or a series of  instructions, indicating the number of repetitions, followed by the code to be repeated enclosed in curly brackets:

  • n{code} = code repeated n times
  • 3{f} = fff
  • 2{fl} = flfl
  • l2{f} = lff

Nested Constructs. Repetitions, just like the remaining constructs described in the following, can also be nested. In other words, the code to be repeated can contain repetitions or other constructs, as in the following examples:

  • 2{2{f}} = 2{ff} = ffff
  • 3{2{f}l} = 3{aas} = fflfflffl

Conditions. In order to express the conditions to which the implementation of certain instruction is subject, the bot uses “if”, enclosing the condition in brackets, and the instructions to be executed under condition in curly brackets:

  • if(condition){code} = execute the code only if the condition occurs
  • if(condition){code1}else{code2} = execute code1 if the condition occurs, else execute code2

The conditions used by the bot are the following:

  • way ahead or there is a way = verified if in the direction of travel there is at least a box to move to
  • way to the right = verified if, with respect to the player’s position and  direction of travel, there is at least one box to the right
  • way to the left = verified if, with respect to the player’s position and direction of travel, there is at least one box to the left
  • star = verified if in the player’s box, around the QR code, there are stars
  • no star = verified if in the player’s box, around the QR code, there are no stars

Conditional Repetitions. The bot uses the term “while” to say that one or more instructions should be repeated as long as a condition persists. The condition is expressed in brackets, while the code to be run is enclosed in curly brackets:

  • while(condition){code} = run the code while the condition occurs.

Attention: in repetitions and conditioned repetitions, you should run the whole code inside each repetition, then you should check once again the condition of repetition (explicit condition or number of repetitions) to decide whether to run it again.

Advice. In order to illustrate the syntax to participants, we suggest that you play a game all together, stating and commenting together the series of instructions which the bot assigns at each step. As an alternative, you can create series of trial instructions, so as to simulate the execution.


CodyMaze is a project of Alessandro Bogliolo, developed by Brendan Paolini, Lorenz Cuno Klopfenstein and Saverio Delpriori, of the Degree Course in Applied Computing of the University of Urbino. The astrophysical version has been developed in collaboration with the INAF Play.coding working group, coordinated by Maura Sandri.

Guarda il video su Media Inaf Tv: