a sumple battleship game written in c using signals 🚥
Please do note there WILL BE memory leaks
This project uses SIGUSER1 and SIGUSER2 to carry out informatio between the two players,
translatting every move into binary and sending it bit by bit.
Maps can be any name and should be in a txt
format and MUST be formated in the following way :
LENGTH : FIRST_SQUARE : LAST_SQUARE
where LENGTH is the length of the ship, FIRST_SQUARE and LAST_SQUARE its first and last positions.
In this file, you must have 4 ships (of lengths 2,3,4 and 5).
Otherwise there will be an error !
(Requires GCC to work)
Start with : make
to build project
you will now have a battleship
binary
(feel free to move it where ever pleases you).
(you might need to chmod +x battleship
to allow its execution)
📺 quick tutorial:
./battleship <path to map> # lauches the game for player one
# this will output you a PID (5 digit number)
./battleship <PID> <path to map> # launches the game for player two
Now each player will have to enter a move each turn, and will have to wait for the other to do so !
And the rest is just the game