Anonymous user
Morpion solitaire/Unicon: Difference between revisions
fix for move log offset error, update help, change a default
m (fix v-space) |
(fix for move log offset error, update help, change a default) |
||
Line 35:
record morpioncell(symbol,direction,row,col) # a grid cell
record morpionmove(direction,move,line,roff,coff)
record morpiongame(grid,log,history,roff,coff,center,pool,move,count) # all game data
Line 66:
end
procedure MorphionMove(MG) #: make a move
put(MG.history,M)
log := FormatMoveLog(M)
log ||:= sprintf(" - of %i choices.",*MG.pool) # append # choices
log ||:= sprintf(" Metric=%i",M_Eval(MG)) # append score (opt)
Line 191 ⟶ 193:
procedure FormatMoveLog(M,roff,coff) #: format a log entry
M.direction,M.line[M.move,1]-roff,M.line[M.move,2]-coff)▼
every x := !M.line do
▲ log ||:= sprintf("[%i,%i] ",x[1]-roff,x[2]-coff)
log ||:= sprintf("[%i,%i] ",x[1]-M.roff,x[2]-M.coff)
return log
end
Line 212 ⟶ 215:
Arguments : ")
every fprintf(&errout," %s",!M_CommandLine)
fprintf(&errout,"_
Morphion [options] Plays the 5T variant of Morphion Solitaire\n_
Where options are:\n_
\t-P|-print
\t\t\tn=2
\t\t\tn=1
\t\t\tn=0
\t-A
\t-E\tSpecifiy an position fitness evaluation function (default none, future)\n_
\t-SW
\t-SD\tSearch depth (strategy dependent, future)\n_
\t\tnote for larger n this benefits from larger BLKSIZE, STRSIZE environment variables\n_ ▼
\t-UN <n> Give status update notifications every n simulations\n_▼
\t-B <n> Keep best n games of unique length (default 5)\n_▼
\t-W <n> Keep worst n games of unique length (default 3)\n_▼
\t-R|-replay\treplay\n_
\t-RF\tfile containing game record to be replayed\n_
\t-RN\tnumber of moves to replay (0=all)\n_
\t-L|-limit\tgames to play (if 0 or less then play until any of 'XxQq' is pressed\n_
▲ \t\tnote for larger n this benefits from larger BLKSIZE, STRSIZE environment variables\n_
\t-?|-h|-help\tthis help text")
stop()
Line 261 ⟶ 263:
M_SrchDep := (0 < \opt["SD"]) | 5
M_Eval := case opt["E"] of {
"
default
}
c := sprintf("# --- Morpion Solitaire 5 (v%s) ---\n#\n",MORPVER)
c ||:= "# Command line options :"
Line 281 ⟶ 282:
c ||:= sprintf("# - Moves to replay = %i\n",0 ~= \M_ReplayAfter)
c ||:= sprintf("# Player Strategy = %i\n",M_Strategy)
c ||:= sprintf("# -
c ||:= sprintf("# - Search Width (strategy dependant) = %i\n",M_SrchWid)
c ||:= sprintf("# - Search Depth (strategy dependant) = %i\n",M_SrchDep)
Line 288 ⟶ 289:
if \opt["Q"] then stop(M_Config,"-Q Stops run after processing options")
else write(M_Config)
/M_Eval := Scorefail
end</lang>
== Multigame Simulation and Monitoring Support ==
Line 477 ⟶ 479:
if \M_ReplayFile then {
M_ReplayFile ? (="Games/", savegame ||:= "-RF" || tab(find(".txt")))
savegame ||:= "-RN" || (0 < \M_ReplayAfter)
}
savegame ||:= sprintf("_%s-%s.txt",deletec(&date,'/'),deletec(&clock,':'))
Line 498 ⟶ 500:
/l := ""
l ||:= sprintf("%i:%i,%i^%i,%i;",
i,m.line[m.move,1]-m.roff,m.line[m.move,2]
if *l > 70 then {
c ||:= l || "\n"
|