21 lines
1.2 KiB
Text
21 lines
1.2 KiB
Text
;The game:
|
|
Given an '''N×N''' square array of zeroes or ones in an initial configuration, and a target configuration of zeroes and ones.
|
|
|
|
|
|
The game is to transform one to the other in as few moves as possible by inverting whole numbered rows or whole lettered
|
|
columns at once (as one move).
|
|
|
|
In an inversion. any '''1''' becomes '''0''', and any '''0''' becomes '''1''' for that whole row or column.
|
|
|
|
|
|
;Task:
|
|
Create a program to score for the Flipping bits game.
|
|
# The game should create an original random target configuration and a starting configuration.
|
|
# Ensure that the starting position is ''never'' the target position.
|
|
# The target position must be guaranteed as reachable from the starting position. (One possible way to do this is to generate the start position by legal flips from a random target position. The flips will always be reversible back to the target from the given start position).
|
|
# The number of moves taken so far should be shown.
|
|
|
|
|
|
Show an example of a short game here, on this page, for a '''3×3''' array of bits.
|
|
<br><br>
|
|
|