Clio Corvid

Writer – Teacher

Menu
  • Welcome
  • Writing
    • Poetry
    • Fragments
    • AI-generated
  • Mathematics
    • Algebra
    • Calculus
    • General
    • Geometry
    • Notation
    • Pedagogy
    • Puzzles and Memes
  • Reflections
    • Diary
    • Reflections
    • Bein’ Enby (Medium)
    • Inside My Mind
    • Other essays
  • Closed Blogs
    • Cerebri Laevi
    • Father’s Opinion
    • Good Men Project
    • Into the Labyrinth
    • Sisyphus Winced
    • Prawn Salad, Ltd.
Menu

Battleships update

Posted on June 28, 2010July 28, 2021 by Clio

I’ve been rather obsessively working on my Battleships program the last few days, and have quite a bit to show for it: The autosolver works now, as does the random puzzle generator. The random puzzle generator is nowhere near as speedy or elegant as the one in Fathom It!, but it’s a start.

For the autosolver, I spent the better part of a programming day working on a blind alley of an approach, placing the 4-ship, then the 3-ships, and so on. I’m not sure where the algorithm went awry, but it consistently failed to work as expected. Then it occurred to me to simply solve the puzzles in a brute force variation of what I use on the harder puzzles:

  • Fill in the easy cells.
  • For the first empty cell, create a test version where it’s a ship, and another where it’s water.
  • Repeat these steps for each of the two test versions.
  • Repeat until all test versions have been completed or ruled out.

I use a List of possible solutions, creating a second List by iterating through the first one, then copying the second List back to the first one and repeating.

Now that the autosolver works, I’m now thinking about adding a puzzle designer so the user can design, test, and save their own puzzles (although I think I’m going to first take some time off from this project to get some other things done).

Share this:

  • Email a link to a friend (Opens in new window) Email
  • Print (Opens in new window) Print
  • Share on Facebook (Opens in new window) Facebook
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on X (Opens in new window) X
  • Share on WhatsApp (Opens in new window) WhatsApp

Leave a Reply Cancel reply

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

Recent Posts

  • Checking In
  • Fractious Fractions
  • Into the Cornfield
  • How Soon Is Now?
  • Roman Re-enacting: Malden 2025

Archives

Log in
©2026 Clio Corvid