Skip to content
Snippets Groups Projects
Commit 5a0bcc22 authored by Ethan Fox's avatar Ethan Fox
Browse files

Update README.md to include topological order

parent 6758abc1
No related branches found
No related tags found
No related merge requests found
...@@ -688,15 +688,27 @@ The following messages may be sent by an engine to a controller: ...@@ -688,15 +688,27 @@ The following messages may be sent by an engine to a controller:
# Footrace Generator Design # Footrace Generator Design
The footrace generator necessitated the use of a dynamic programming algorithm rather than a greedy algorithm. If a greedy were used, it would The design for the footrace generator is as follows:
value the most movement north but would place the piece in situations that require more moves to reach the end.
`findStartingSituationAndFastestMoveSequence(position)` is the main dynamic programming algorithm.
The code uses `ONE_LANE_GAME` and `TWO_LANE_GAME` to generate the puzzles. The algorithm is only used for the `ONE_LANE_GAME` to generate a path. * The footrace generator necessitated the use of a dynamic programming algorithm
rather than a greedy algorithm. If a greedy were used, it would value the most
movement north but would place the piece in situations that require more moves
to reach the end.
* `findStartingSituationAndFastestMoveSequence(position)` is the main dynamic
programming algorithm.
* The code uses `ONE_LANE_GAME` and `TWO_LANE_GAME` to generate the puzzles.
The algorithm is only used for the `ONE_LANE_GAME` to generate a path.
The `ONE_LANE_GAME` is then mirrored to make the `TWO_LANE_GAME`. The `ONE_LANE_GAME` is then mirrored to make the `TWO_LANE_GAME`.
When the dynamic programming algorithm is run, the board contains pawns and towers. * When the dynamic programming algorithm is run, the board contains pawns and towers.
* Each vertex of the DAG is a `Situation`. These vertices are added to the DAG using
`selectBetterBackpointer()`.
Each vertex of the DAG is a `Situation`. These vertices are added to the DAG using `selectBetterBackpointer()`. * Each edge of the DAG is a move. The algorithm finds the move leading to a `Situation`
in the `predecessor` index of `backpointersTable`.
Each edge of the DAG is a move. The algorithm finds the move leading to a `Situation` in the `predecessor` index of `backpointersTable`. * The topological order is determined by comparing the y values of two `Situation` objects.
\ No newline at end of file If there is a tie, the x values are compared.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment