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'; @abcUchars='0123456789'translate(@abc; upper )||@abcU; @digS=0123456789abc
@chars=@digS||@abcU||@abc; @@.=
@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:110ex100ex;overflow:scroll">
·╞···╔══╗···
·|···║··║···
Line 511 ⟶ 510:
 
move 1 (3,3) with "0"
... previous 4346 moves elided ... above is the initial board (grid) ...
--- the next line means: 44th47th move, position=89,59 marked with an "hk" ---
move 4447 (89,59) with "hk"
 
·|············
·|··bTXUQiQagP·····
·╞j·d╔══╗F·W╔══╗F···
·|···║OR║PhO║NL║ck···
·|CCZ1║bK║3MD·1║VM║3SD·
·|╔══╝57╚══╗X╔══╝57╚══╗f·
·|║YHASGBJR║·HA·KBJY║·
·├║├║UT8I·9·e║·N8IG9hZ║·
·|╚══╗46╔══╝··
·|V··0║cL║20║W·║2····
·|···║da║e║··║·····
·|···╚══╝E····
─┼──g─┴─f──╨──┼────┴────╨──
·|············
═════════════════════════════════════════════════════count of (above) wins = 44
═════════════════════════════════════════════════════ count of (above) wins = 47
 
* number of wins = 4447
</pre>