Project Hub - LogicalBattleShip

Resources

Relevant Course Notes:

Canva:

Git repo:

Presentation:

Brainstorming

  • Constraint: Maximum 10x10
  • Add rocks randomly in the map for making the game faster
  • 4 types of boats: {(1x2), (1x3), (1x5), (2x2)}
  • Battleships cannot be placed contiguosly in the grid i.e. attach two ships together.

Let’s start with a toy example:

  • 5x5
  • Only two types of boats

Dev log

  • I choosed the PySAT library, i will use only propositional logic since the game is finite. Made brainstorming and choosed a toy example
  • To solve the inference of a Battleship game i can use only propositional logic.
  • Make github repo
  • Defined all rules in the README, heuristics included
  • Used a lot of AI agents but they made the work faster, i mainly told them what to implement step by step and refactored code to make it clearer to read for humans.
  • Implemented the main basic game initialization logic with placement of the 2 smaller boats. Game also supports different size boards
  • Implemented random game generation
  • Implemented a simple visualization in PyGame.
  • Added rules for remaining boats
  • Redesigned the boards, now we have a truth board and an agent board.
    • The agent knows consequences of the game but not all the information on the board. The agent keep a mental state (see relevant lecture) of the board as the game proceed. Ofcourse it know consequences, so it know that destroying 1x2 contiguos ShipPiece(s), and the surrounding is empty, means Patrol Boat is destroyed so in consequent open hit it should not look for a Patrol Boat.
  • Implemented every MVP feature + nice to have features except for skin for boats (don’t have intention to add them), it also have a multiplayer agent vs agent with checkerboard vs random strategy.

Tasks

FeaturesMVPNice to have featuresBanned Features
=====Define all rules in READMEFull game 10x10 with 5 types of shipsNetworking
=====5x5 game with 2 types of shipsLocal multiplayer, play vs botFancy boats with spirites, skin and similar
=====Logic solver in PySAT with Exploration phaseEasy AI generated skin for boats
=====Random game GenerationBetter GUI: Player 1, player 2, previous move above the board
=====Simple visualization in PyGame
=====1v1 agent vs agent
  • Create a project on Obsidian.
  • Play Battleship to get an intuitive idea.
  • Check out various libraries: PySAT, PyLogic, PyPlan, PyCogent…
  • Transform the world and rules into a Knowledge Base (Knowledge Engineer).
    • FOL or Propositional??
    • Add in the repository a README with the KB written in english and the corresponding logical rules
    • Add to the README the rules for the remaining 2 bigger ships
  • Define MVP, features “nice to have” and banned features that requires too much time.
  • Make a github repository
  • Randomly generate a game, maybe one that has already started.
  • Visualize the game using Pygame.
  • MVP: simple boats, all of size 2 or 3.
  • The program should demonstrate that if there are no visible boats, it should randomly sink a cell (exploration).
  • Add the SAT solver in python-sat that uses the heuristics explained in the README
    • When implementing the sat solver be careful to consider this: the agent doesn’t know that the surrounding of a board is “clear” until he knows the entire ship position and therefore until the agent sunk the boat. Only after the boat is sunk then the agent can infer that the surrounding are clean therefore neg SP therefore neg H
    • Document better the SAT solver and be sure to understand what question is asking
    • Right now the SAT solver is omniscent, the opponent’s board should be hidden from the Agent. The Agent should keep two CNF instances: one with ground truth and one with only the agent’s observations
  • Make a 1v1 game, where two agents, that see two different board (the respective opponent boards) and they try to win.

Comments