8000 GitHub - minco3/Battleship: 1 or 2 player battleship game playable in a terminal window
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

minco3/Battleship

Repository files navigation

Battleship

1-2 player battleship game played in a terminal window

Description

  • My final project for my introductory C++ class
  • 1 player and simulation mode's AI uses a probability map to determine the best move
  • has a seek / hunt mode
  • the player is able to place their ships on the board with colision detection to make sure the ships are being placed correctly
  • by using the simulation mode I was able to test all edge cases that the AI would face and was able to optimize it so the average turns per game was around ~23

What I Learned

  • deeper understanding of 2D arrays
  • calling values by reference
  • how to efficiently test code
  • game loop

Screenshots

placing a ship gameplay simulation mode results

Getting Started

Dependencies

  • GCC
  • CMake

Setup

  • if you want to modify the ship lengths or names ships.txt is modifiable and is checked at runtime
  • the first row is ignored as it is used for the column names

simple setup with CMake and GCC

mkdir build
cd build
cmake .. -G "Unix Makefiles"
cmake --build .
main

About

1 or 2 player battleship game playable in a terminal window

Resources

Stars

Watchers

Forks

0