Skip to content

toro-nicolas/my-navy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my_navy ⚓

my_navy

Table of contents 📑

Project goal 🎯

Reproduction of a naval battle game in C.
The program uses signals (SIGUSR1 and SIGUSR2) and the TCP protocol to communicate between players.

How to compile it ? 🛠️

Make the game :

make

Make the libs :

make libs

Re make the game :

# This command will deleted all the compiled files
make re

Remove all compiled files (*.o) :

make clean

Remove all compiled files (*.o), all compiled libs (*.a), all unit tests and program executable :

make fclean

Make a unit_tests file :

make unit_tests

Make and run a unit_tests file with the coverage :

make tests_run

How to use it ? 💻

Player 1 :

./my_navy [map]

Player 2 :

./my_navy [player_one_pid] [map]

How to create a valid map ? 🛥

To make a valid map, you need a file containing 4 boats in this form : [length]:[start_position]:[end_position].
Each boat must be a different size. Boats can't be diagonal, cross each other or be on the same coordinates.

Example :

2:C1:C2
3:D4:F4
4:B5:B8
5:D7:H7

Final result on my.epitech.eu 🚩

Test name Status
Is not a cheater
Player connection
Player waiting connection
2 boats has same length
Bad boat length
Bad file path
Miss argument split
Miss argument value
Miss one boat
Too few arguments
Wrong argument value
Player 2 attack
Player 1 wait for attack
Player 2 attack
Player 2 wait for attack
Player 1 attack - eval
Player 1 wait for attack - eval
Player 2 attack - eval
Player 2 wait for attack - eval
Attack again after wrong position
Attack same position twice
Attack wrong position 1
Attack wrong position 2
Attack wrong position 3
Game end
Player 1 attack hit
Player 1 attack missed
Attack again after wrong position - eval
Attack same position twice - eval
Attack wrong position 1 - eval
Attack wrong position 2 - eval
Attack wrong position 3 - eval
Game end - eval
Player 1 attack hit - eval
Player 1 attack missed - eval

I obtained 83.7% with 98% lines and 89% branches in the last test.

About

Reproduction of a naval battle game in C.

Topics

Resources

Stars

Watchers

Forks

Contributors