Week 7

 Used a YouTube walk through to learn about making a game through a tic-tac-toe example

The picture above is me creating objects for my game board and for the pieces, followed by the constructor that creates the game board and calls the first turn method(which decides who does first). 

This method sets the buttons on the grid and calls the check method( which checks if you win or not)  

   
The first turn method decides which piece goes first and then displays it for 2000ms (2secs)


This above is the win conditions. The picture above is the part of the code because there are quite a few win conditions. It takes the position of the buttons(pieces) and see if it matches a winning position.


This is the result of winning. if they have a winning combination , it takes the position and highlights the combination in green for both X's and O's and prints at the top ( _ wins)



my main that calls the game





Pictures of the game( x winning, o winning, and when it first starts up)


Citation:

Java Tic Tac Toe Game ⭕ - youtube. (n.d.). Retrieved March 26, 2022, from https://www.youtube.com/watch?v=rA7tfvpkw0I 

Comments

Post a Comment

Popular posts from this blog

Week 9

Week 10

Week 11