Homer White’s Website
  • Home
  • About
  • Articles
  • Blog
  1. Articles
  2. Canvas Battleship
  • Articles
    • Advent of Code 2022
    • Browser Implementation
    • Canvas Battleship
    • Observables Scatterplot
    • Stock Prices
    • Arquero Wrangling
  • Posts
    • Let Your Toddler Set Off Freaky Fireworks
    • Emdedding Observable Cells in a Web Page
    • Green Turtles Make Peevish Pets
    • Toddlers Will Eat Your Legos, But Feed Them Checkers, Too!
    • Pink Parabolas Make For the Merriest Mathematics
    • Yellow Throttles Make Terrible Toys for Toddlers
    • Footnotes in Quarto
  1. Articles
  2. Canvas Battleship

Battleship with Canvas

Here is a simple game of Battleship!

You play against the computer. Select a point at which to drop a bomb by clicking in the computer’s area, which is the upper part of the “ocean” shown belw. The bomb explodes, and any ship that is within a set radius of the point of explosion sustains a hit. Each ship has a hit-capacity; when it takes a number of hits equal to its capacity it is sunk.

The game is a work in progress (see the Github repository). It is implemented in the browser with the Canvas API.

game intended here
Show shot history:

  • Report an issue