GithubHelp home page GithubHelp logo

joelman111 / battleship-ai Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8.98 MB

A GUI-based implementation of Battleship with an AI that uses the user's past ship placements to inform its future guesses.

Python 100.00%

battleship-ai's Introduction

Battleship

A GUI-based implementation of Battleship with an AI that uses the user's past ship placements to inform its future guesses.

Description

A GUI-based implementation of the classic 2-player board game Battleship using Pygame. The game is single player with a lightweight AI that makes intelligent guesses based on the most likely remaining spots on the board and where the user has placed their ships in the past to inform its future guesses. The AI wins within 6 moves (on average) of the computationally-hard provably optimal algorithm, but is far performant. The game has music, sound effects, and basic graphics. This was a hackathon project completed by 3 college freshmen in under 15 hours, which earned us third place out of ~70 submissions.

Getting Started

Installing

git clone https://github.com/Joelman111/Battleship-AI.git
pip install -r requirements.txt

Executing program

python main.py

Help

In game, you can hit 'i' to toggle the help screen, which will tell you all of the options for the current page. Once the game is over, hit 'm' to go back to the main menu and play again. The game will generate a "battleship.txt" file to persist user ship placements- to reset user ship placements, just delete this file.

Authors

Joel Miller ([email protected]), John Solomon, Sebastian Gamboa

Demo Video

Battleship

battleship-ai's People

Contributors

joelman111 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.