Skip to content

Recursive move generator Inadequately recursive #8

@ikyman

Description

@ikyman

Take a look at this Comic.

Image

Note that Hobbe's paw goes in a sort of semi-circle. Checkers pieces can change directions while in the middle of their recursion.

Currently I do not support this: For example, a Bishop has 4 recursive moves: NE Recursively, NW recursively, SE Recursively, and SW Recursively.
This worked well enough back when I was assuming pieces can't change directions in the middle of moving. It has the added bonus of preventing the infinite Loop Situation, where a Rook moves north, then south, then north and south and north ad infinitum.

A King-ed Checkers Piece has the same move direction options, regardless of location. They prove that unidirectional recursion, what I have now, doesn't work.

To check how Checkers Pieces move, I will have to switch from iterative recursion to branching recursion.
A Rook Now has two move generators instead of 4: Move Left or right recursively, or Up & Down Recursively.

The "Don't Jiggle back and forth in an infinite loop" can be dealt with by simply banning the previous square.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions