Overview
In this Minecraft game, the player will be standing in front of a 3x3 wall of blocks. At random times, one of the 9 blocks will change its colour. The aim of the game is to react to the change in the quickest possible time. The user will have to right-click on the correct block to move to clear the board and allow another random block to change. The time between block colour change and the reaction is recorded. The game ends after 10 iterations. The final score is the sum of all the individual times for reactions.

Prequisites
Minecraft Development environment set up - see LINK.
Base code
Implementation steps
There are a thousand ways to implement the game. Feel free to define your algorithm or base it on the below:
​
-
Test the base code, you might need to adapt the coordinates. In the beginning, the program would work in an endless loop with no changes to the board. Try changing one of the values in the board list to see if a block would be illuminated. Pick and choose the two colours you like by updating the DISABLED and ENABLED constants
-
Add more code to IlluminateBlock() to change a single block and then display the board. Firstly, the updated block could have hardcoded (static) coordinates. Once that works, make the block indices random (dynamic). Test your code. Can you see a different block illuminated every time you run the program? Make sure the indices of the illuminated block are stored in board_column and board_row variables. This will be required in order to disable the blocks later in another function.
-
The next step would be to detect that the player clicked on the illuminated block. Update the DetectPlayersHit() function so that a message is displayed once the correct block has been hit. You can use colour id in the conditional statement here. Test your code.
-
Let's add the timing now. For that, you need to record (store) the timestamp of the moment right after the block is illuminated and one more to reflect when the block has been hit. Overall time could be calculated by subtracting these two values. Once you calculated this in the DetectPlayersHit() function, display this as a string to the player. and return the value as float (real)
-
We measure the time but the board is getting polluted with all the illuminated blocks. After every successful hit, change the block colour to DISABLED.
-
Test your code. At this point, you should have randomly illuminated blocks and individual times displayed to the player. The game should finish after 10 rounds.
-
Let's add a random delay to make it harder to spot which block is being illuminated. Update RandomSleep() funtion
-
The final step is to display the final score to the player
​
Game extensions
-
Make the board bigger (either 4x4 or 5x5) and adjust the code to have blocks illuminated across whole board
-
Store the best (lowest) score in a file and display a message when beaten. See https://github.com/wasilpaw/ohsnapcoders/blob/main/maze_game.py for an example of writing to and reading from a file.