Noughts and Crosses
Overview
"A game for two players who take turns marking the spaces in a three-by-three grid with X or O. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner."
In the Minecraft version of the game we will use 9 blocks. Players should click on the blocks in turns changing their type of colour to indicate their move.
You will start with a skeleton of the code and your goal will be fill it in to make a fully functional game.

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. The green player should be able to mark up to 5 blocks.
-
Detect the hit from the red player.
-
Ensure that all 9 moves can be done
-
Add code to check if the player has 3 blocks of the same colour in a line and finish the program in that case
-
Add some messages helping players understand who's turn is it or who has won.
Challenges
There are a thousand ways to implement the game. Feel free to define your algorithm or base it on the below:
-
Refactor your code, can you create a single PlayerMove() function that works for both players? You could make the player's colour a parameter of the function. Can you refactor the check functions in a similar manner by creating DidPlayerWin()?
-
Use a bigger wall, for example, 4x4.