Get ready to sink some freakin ships, my friend.

Inspiration As first-year engineers and first-time hackathoners, we don't have much experience with taking on coding projects larger than a calculator (Thanks ENED.) However, we wanted to push our limits with what we can learn, like classes and very basic AI, and implement those new techniques into a game that's fun to play!

What it does The user is playing against an automated opponent. The opponent AI was developed to have a very chronological guessing pattern so that if it hits a ship, it will set the next x amount of guesses in a radius around that origin point based on how many previous hits it has and the shot's location in reference to the origin.

How we built it We established our game board by a 10x10 zero matrix. Numbers 1 through 5 are designated ships, 6 is a hit, and 7 is a miss. When each shot is generated, the matrix is updated with the corresponding value so that it can be determined when an entire ship is sunk and when the game ends.

Challenges we ran into Our initial code was a hot mess. It was confusing, repetitive, and although it was compiling, it was not following the logic we intended it to. We then, in the wee hours of the night, broke the process down into very specific portions and introduced functions and classes to create an easy-to-follow program.

What's next in Battleship GUI! We really wanted to create an awesome user interface but the baseline code took too much time, but we are definitely planning on getting a GUI up an running in the near future :)

Built With

Share this project:

Updates