Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2022:agmocanu:nine_men_s_morris [2022/05/27 21:33]
luca.muntean [Jurnal]
pm:prj2022:agmocanu:nine_men_s_morris [2022/05/27 22:39] (current)
luca.muntean [Bibliografie/Resurse]
Line 31: Line 31:
 ===== Software Design ===== ===== Software Design =====
 {{:​pm:​prj2022:​agmocanu:​muntean_luca_code.zip|Source Code}} {{:​pm:​prj2022:​agmocanu:​muntean_luca_code.zip|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 ===== ===== Rezultate Obţinute =====
 +{{pm:​prj2022:​agmocanu:​luca_pic.jpg?​ 400}}
 +
 +Demo Video: https://​youtu.be/​NkT_JMXXI0Y
 +
  
  
  
 ===== Concluzii ===== ===== 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
  
  
Line 48: Line 76:
  
 ===== Bibliografie/​Resurse ===== ===== 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 ​
 +
  
  
pm/prj2022/agmocanu/nine_men_s_morris.1653676427.txt.gz · Last modified: 2022/05/27 21:33 by luca.muntean
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0