Also known as Battleships. Features a somewhat competent AI opponent.
This was made for a school assignment. The fancy GUI and smart-ish AI was some extra work I added for spice. The code is sparsely commented, but I made sure to name everything not too obscurely. Most of the code should read like proper sentences.
In regards to the disputed rule of "If you are allowed to place ships next to each other", you are allowed to. Not only because I did not know about this potential rule until after I was pretty much done with the game, and it would be a bit of a bother to code, but because the assignment did not include those in the listed rules (Though implementing this rule would absolutely make my AI flawless!).
The AI works pretty well, I do dare say. However, under certain circumstances it will mess up and will then have to default to taking random shots. But outside of that, it works flawlessly. It will shoot randomly until it hits a ship, after which it will engage the Smartness™* to find the rest of the ship by shooting the adjacent squares.
This game is impossible to crash from accepted user inputs, I also do dare say. Do feel free to prove me wrong!
*Smartness™ is not an actual trademark (As far as I know, I don't own it anyway) and is just a childish joke.