Battleship In Python 2.7

Battleship Python
December 2016

Python 2.7 – vPython Graphics Library

While all the knuckleheads learning C++ were just getting around to for loops, our Python class had final projects of making a “video game”. Video game should probable be nested in 7 or 8 quotes here, but all us scraped some kind of interactive, graphically-dominated time waster. My team chose Battleship, the ultimate game of chance in which skill is almost totally unnecessary. The rest of team handled graphical elements. I wrote the “game engine” (again 7 or 8 quotes may be necessary).

It was fun busting up the human behavior elements of Battleship and getting the “computer” to behave in mostly-similar ways. Basically, the plan was to randomly select coordinates from the grid. When a hit was made,a person switches to “plus sign mode” where they figure out the orientation of the ship. Once that’s done, the person switches to “linear mode” and goes down the line until the ship sinks or they miss. That was fun to implement.

Source Code: Battleship_Final

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.