
#include "engine.bas"

dim g as tGrid
dim e as tEngine
g.Empty

dim p as integer = cWhite ' piece color

open "Log.txt" for output as #1

do
  if g.Insert(p, e.BestMove(g, p)) then
    print #1, g.AsString;
    print #1, "Flag=" & str(e.flag)
  ' BestMove() function exit flag
  ' You don't need to care of the flag value, except if you want to understand
  ' how each "best" move has been selected.
  ' 1 = winning move
  ' 2 = defending
  ' 3 = attacking
  ' 4 = to center
    p *= cBlack
  else
    print #1, "This shouldn't happen."
  end if
loop until (g.GridPoints(p) >= four) or g.IsFull

close #1
