5 / 100
- Support a menu.
- Play a new game. (Overwrite save file with default state/values).
- Load game.
- Support two (human) players on the same console (aka the cli command line console). Player vs player. No computer. No need to implement single player mode.
- No need to hide each players maps, print both players map on the output.
- During each player’s turn print their statistics and state of each of their ship.
- Mini-menu: Give player the choice to ‘Fire’, ‘Save’, ‘Quit’.
- On map, use ‘~’ as water, ‘M’ as misses, ‘H’ as hits.
- Support dynamically sized maps using heap memory
- Implement the maps as a dynamically generated 2D array (hint: malloc or calloc)
- Randomly generated map size (hint; rand srand)
- Keep the random map size between 10×10 to 50×50. No need to overkill.
- Nothing fancy for printing a map, use ascii art.
- Players manually place their ships on the map.
- Choose orientation of each ship.
- Place ship on map by asking player to choose a coordinate on the map. The program will automatically do the rest (left to right if horizontal or up to down if vertical).
- Ships must be within bounds of the map.
- Must not overlap each other.
- Program must run with a save file (like save.txt or save.log). This file is use to save or load the game.
- Support saving a game.
- Each player’s statistics (hits, misses, state of each ship (either sunk, number times hit)
- Each player’s map.
- Support loading a saved game and continuing from there.
- Game is turn based. Each player takes a turn until a winner or someone quits.
- No third-party header files/libraries. Use the standard libraries for C.
One of each ship must be placed on the map:
- Patrol Boat (2 Length) On map represent as ‘P’.
- Aircraft Carrier (5 Length) On map represent as ‘A’
- Battleship (4 Length) On map represent as ‘B’
- Destroyer (3 Length) On map represent as ‘D’
- Submarine (2 Length) On map represent as ‘S’
- Cruiser 3 (Length) On map represent as ‘C’