Anonymous user
Morpion solitaire: Difference between revisions
m
→{{header|REXX}}: replaced the example with a higher win, removed dead code. -- ~~~~
(force a table of contents with a __TOC__. -- ~~~~) |
m (→{{header|REXX}}: replaced the example with a higher win, removed dead code. -- ~~~~) |
||
Line 291:
=={{header|REXX}}==
This REXX program is an attempt to play (badly, and with random moves) the game of Morpion solitaire by a computer.
<br><br>The program also allows a carbon-based life form (er, that is, a human) to play.
<br><br>This is a work in progress and currently doesn't log the moves in the manner asked for by this task.
<br>The moves are marked by ''' 0123456789ABC...XYZabc...xyz()[]{}<>«» ''' and thereafter by a plus sign (+) on the board which is shown in 2D.
<br>This allows 73 unique moves to be shown on the board (or grid), but all moves are also logged to a file.
Line 383:
end /*y*/
@abc='abcdefghijklmnopqrstuvwxyz'; @
@chars=@chars'()[]{}<>«»' /*can't contain "empty", ?, blank*/
Line 401 ⟶ 400:
do x=loX to hiX /*build an "X" line.*/
!=@.x.y; xo=x==0; yo=y==0
if !==empty then do /*grid transformation*/
if xo then !='|'
if xo & y//5 ==0 then !='├'
Line 410 ⟶ 409:
if xo & yo then !='┼'
end
_=_ || !
end /*x*/
call t _ /*...and display it.*/
Line 495 ⟶ 494:
'''output''' when running 1,500 trials, the highest win was a meager 44 (four games, all different), and
one of them is shown below.
<pre style="height:
·╞···╔══╗···
·|···║··║···
Line 511 ⟶ 510:
move 1 (3,3) with "0"
... previous
--- the next line means:
move
═════════════════════════════════════════════════════ count of (above) wins = 47
* number of wins =
</pre>
|