RosettaCodeData/Task/Flipping-bits-game/QB64/flipping-bits-game-2.qb64
2023-07-01 13:44:08 -04:00

91 lines
3 KiB
Text

Flipping Bits Game, now with AI! b+ 2017-12-18
You will be presented with a square board marked Current and
another marked Target. The object of the game is to match
the Current board to Target in the least amount of moves.
To make a move, enter a letter for a column to flip or
a digit for a row to flip. In a flip, all 1's are
changed to 0's and all 0's changed to 1's.
You may enter 0 or q at any time to quit.
You may press ? when prompted for move to get a hint.
You may press ! to have the program solve the puzzle.
Please press how many cells you want per side 2 to 9 > l
Please press how many cells you want per side 2 to 9 > *
Please press how many cells you want per side 2 to 9 > 3
--------------------------------------------------------------------------------
Current: Target:
a b c a b c
1 1 1 0 1 0 1 1
2 1 1 0 2 0 1 1
3 0 0 1 3 0 1 1
Number of moves taken so far is 0
Press a lettered column or a numbered row to flip (or 0,q,?,!) > l
Press a lettered column or a numbered row to flip (or 0,q,?,!) > 9
Press a lettered column or a numbered row to flip (or 0,q,?,!) > *
Press a lettered column or a numbered row to flip (or 0,q,?,!) > a
--------------------------------------------------------------------------------
Current: Target:
a b c a b c
1 0 1 0 1 0 1 1
2 0 1 0 2 0 1 1
3 1 0 1 3 0 1 1
Number of moves taken so far is 1
Press a lettered column or a numbered row to flip (or 0,q,?,!) > ?
Hint: c
Press a lettered column or a numbered row to flip (or 0,q,?,!) > c
--------------------------------------------------------------------------------
Current: Target:
a b c a b c
1 0 1 1 1 0 1 1
2 0 1 1 2 0 1 1
3 1 0 0 3 0 1 1
Number of moves taken so far is 2
Press a lettered column or a numbered row to flip (or 0,q,?,!) > l
Press a lettered column or a numbered row to flip (or 0,q,?,!) > 9
Press a lettered column or a numbered row to flip (or 0,q,?,!) > !
For the next move, the AI has chosen: 3
Running the solution with 4 sec screen delays...
--------------------------------------------------------------------------------
Current: Target:
a b c a b c
1 0 1 1 1 0 1 1
2 0 1 1 2 0 1 1
3 0 1 1 3 0 1 1
Number of moves taken so far is 3
For the next move, the AI has chosen: Done?
Running the solution with 4 sec screen delays...
--------------------------------------------------------------------------------
Current: Target:
a b c a b c
1 0 1 1 1 0 1 1
2 0 1 1 2 0 1 1
3 0 1 1 3 0 1 1
Number of moves taken so far is 3
Done! Current board matches Target
Press y for yes, if you want to start over: > m
--------------------------------------------------------------------------------