top of page

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.

KaC.PNG

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:

 

  1. Test the base code. The green player should be able to mark up to 5  blocks.

  2. Detect the hit from the red player.

  3. Ensure that all 9 moves can be done

  4. Add code to check if the player has 3 blocks of the same colour in a line and finish the program in that case

  5. 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:

 

  1. 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()?

  2. Use a bigger wall, for example, 4x4.

© 2021 by OhSnapCoders & Pawel Wasilewski. Proudly created with Wix.com

  • Facebook Social Icon
  • Twitter Social Icon
  • Google+ Social Icon
bottom of page