Creative Coding + Physical Computing
2023.11
This project is a simple Tic-Tac-Toe game with a physical interface.
The game controls are physical, built using buttons and a potentiometer, and connected using Arduino. The game board is implemented digitally using p5.js. Two parts are connected using serial.
The potentiometer is used for selecting the box on the board, and the buttons are for two player to assign the box with different shapes. When the box is selected, it will be highlighted and slowly flash. The turn cue will show at the top of the board all the time during the game. The game can be reset by pressing [R] on the keyboard.
The value of the potentiometer is divided into 9 intervals in the Arduino code to assign to 9 boxes on the board respectively. Different numbers will be sent through the serial when the potentiometer has a different value to differentiate which box on the board is selected.
Each player has a separate button and can only be used during the turn. Boxes that are already assigned cannot be assigned again, and only the unassigned boxes can be selected. After the board is full, the turn cue will disappear, and the players can restart the game using the [R] key on the keyboard. Players can also reset the game anytime during the game.
I didn’t implement any computation for the result of the game so the players need to tell it by themselves. If I have more time to work on this project, I might add the result computing feature to make this game more intelligent.
The Arduino code and p5 code are available on my Github.
Tools: Arduino, p5.js