Table of Contents

Nine Men's Morris on LCD

Introducere

Prezentarea pe scurt a proiectului vostru: A device that lets you play Nine Men’s Morris with your friend on an LCD display. The scope of the project is to make a digital version of the board game. I wanted to recreate a classic board game on an electronic device. I think the device will be useful to people that want to play the game without carrying the board and the pieces with them.

Descriere generală

The game receives an input from the two joysticks and buttons which is processed by the Arduino UNO Micontroller and displays the information on the LCD (which serves as the game board) which actively modifies its output accordingly.

Hardware Design

List of required Pieces:

muntean_luca_sketch.jpg luca_schem.jpg

Software Design

Source Code

Git: https://github.com/luca1911/MA_code_muntean_luca/blob/main/sketch_may23a.ino

Developed in Arduino IDE

External libraries used: SPI.h and TFT.h Both libraries are used to simplify the process of drawing shapes on the display.

Code functionality:

The code is based on a matrix that works as the board for the game, each piece (white and black) is assigned a number which is placed in the matrix.

I used 4 functions to move around the board to the adjacent square in each of the 4 directions(up, down, left, right)

There s also a function that checks if a mill was formed (3 pieces of same color have been placed in a row)

Two types of turn functions are used depending on the state in which the game is(if all 9 pieces have been placed on the board), both of them use the 4 movement functions which are controlled by the joystick to select a square to place the piece in. once the button is pressed and the piece is placed the mill check function is immedietly called to verify if the piece you just placed formed a mill in which case the “Remove” method is called to navigate to one of the opponents pieces and remove it by pressing the button. The first type of turn works by placing all of your 9 pieces on the board, while in the second one, you have to move your already placed pieces to adjacent squares. If one player only has 3 pieces remaining on the board, they will be allowed to move their pieces to any empty square(not only ajacent). The game ends when one player loses by only having 2 pieces left. The game method is the main method that controls which type of turn will be played next.

Rezultate Obţinute

Demo Video: https://youtu.be/NkT_JMXXI0Y

Concluzii

I actually enjoyed working on this project more than I initially thought I would and managed to build this little game device of which i am really proud of.

By working on this project i managed to also get the skills necessary to use an lcd display and joystick and combine that with my knowledge from the lab in order to complete the project

Bibliografie/Resurse

https://en.wikipedia.org/wiki/Nine_men%27s_morris

https://exploreembedded.com/wiki/Analog_JoyStick_with_Arduino

https://create.arduino.cc/projecthub/electropeak/ultimate-beginner-s-guide-to-run-tft-lcd-displays-by-arduino-081006

Fritzing

Export to PDF