From c77dc7860af661ee6e2dfaf8733b7c734875949d Mon Sep 17 00:00:00 2001 From: davidly Date: Sat, 27 Jan 2024 09:38:27 -0800 Subject: [PATCH] improve performance --- turbo1_cpm/TTT-CPM.PAS | 516 +++++++++++++++++++++++------------------ turbo3_cpm/TTT-CPM.PAS | 516 +++++++++++++++++++++++------------------ 2 files changed, 586 insertions(+), 446 deletions(-) diff --git a/turbo1_cpm/TTT-CPM.PAS b/turbo1_cpm/TTT-CPM.PAS index d5f4ac0..76089de 100644 --- a/turbo1_cpm/TTT-CPM.PAS +++ b/turbo1_cpm/TTT-CPM.PAS @@ -1,223 +1,293 @@ -{ App to prove you can't win at Tic-Tac-Toe } - -{ If this flag isn't set, recursion doesn't work on CP/M } -{$A-} -{ This flag turns off checking if the recursion stack and heap collide } -{$K-} - -program ttt; -{$I timeutil.pas} -{$I cpm_gt.pas } - -const - scoreWin = 6; - scoreTie = 5; - scoreLose = 4; - scoreMax = 9; - scoreMin = 2; - scoreInvalid = 0; - - pieceBlank = 0; - pieceX = 1; - pieceO = 2; - - iterations = 1; - -type - boardType = array[ 0..8 ] of integer; - CommandString = string[127]; - -var - evaluated: integer; - board: boardType; - timeStart, timeEnd: timetype; - -procedure dumpBoard; -var - i : integer; -begin - Write( '{' ); - for i := 0 to 8 do - Write( board[i] ); - Write( '}' ); -end; - -function lookForWinner : integer; -var - t, p : integer; -begin - {dumpBoard;} - p := pieceBlank; - t := board[ 0 ]; - if pieceBlank <> t then - begin - if ( ( ( t = board[1] ) and ( t = board[2] ) ) or - ( ( t = board[3] ) and ( t = board[6] ) ) ) then - p := t; - end; - - if pieceBlank = p then - begin - t := board[1]; - if ( t = board[4] ) and ( t = board[7] ) then - p := t - else - begin - t := board[2]; - if ( t = board[5] ) and ( t = board[8] ) then - p := t - else - begin - t := board[3]; - if ( t = board[4] ) and ( t = board[5] ) then - p := t - else - begin - t := board[6]; - if ( t = board[7] ) and ( t = board[8] ) then - p := t - else - begin - t := board[4]; - if ( ( ( t = board[0] ) and ( t = board[8] ) ) or - ( ( t = board[2] ) and ( t = board[6] ) ) ) then - p := t - end; - end; - end; - end; - end; - - lookForWinner := p; -end; - -function minmax( alpha: integer; beta: integer; depth: integer ): integer; -var - p, value, pieceMove, score : integer; -begin - evaluated := evaluated + 1; - value := scoreInvalid; - if depth >= 4 then - begin - p := lookForWinner; - if p <> pieceBlank then - begin - if p = pieceX then - value := scoreWin - else - value := scoreLose - end - else if depth = 8 then - value := scoreTie; - end; - - if value = scoreInvalid then - begin - if Odd( depth ) then - begin - value := scoreMin; - pieceMove := pieceX; - end - else - begin - value := scoreMax; - pieceMove := pieceO; - end; - - p := 0; - repeat - if board[ p ] = pieceBlank then - begin - board[ p ] := pieceMove; - score := minmax( alpha, beta, depth + 1 ); - board[ p ] := pieceBlank; - - if Odd( depth ) then - begin - if ( score > value ) then - begin - value := score; - if ( value = scoreWin ) or ( value >= beta ) then p := 10 - else if ( value > alpha ) then alpha := value; - end; - end - else - begin - if ( score < value ) then - begin - value := score; - if ( value = scoreLose ) or ( value <= alpha ) then p := 10 - else if ( value < beta ) then beta := value; - end; - end; - end; - p := p + 1; - until p > 8; - end; - - minmax := value; -end; - -procedure runit( move : integer ); -var - score: integer; -begin - board[move] := pieceX; - score := minmax( scoreMin, scoreMax, 0 ); - board[move] := pieceBlank; -end; - -function Trim( intext : CommandString ): CommandString; -var FirstPos, LastPos: integer; -begin - FirstPos := 1; - while ( FirstPos <= Length( intext ) ) and ( intext[FirstPos] = #32 ) do - FirstPos := FirstPos + 1; - - LastPos := Length( intext ); - while ( LastPos >= 1 ) and ( intext[LastPos] = #32 ) do - LastPos := LastPos - 1; - - Trim := Copy( intext, FirstPos, LastPos - FirstPos + 1 ); -end; - -var - i, loops, code: integer; - strArg : CommandString; - cmdTail : CommandString absolute $80; -begin - loops := Iterations; - - { on cp/m 2.2 the length is 1 for no arguments -- it's just a space } - - if ( mem[ 128 ] > 1 ) then - begin - { trim the space at the start that's always there } - - strArg := Trim( cmdTail ); - Val( strArg, loops, code ); - end; - - if ( loops > 0 ) then - begin - for i := 0 to 8 do - board[i] := pieceBlank; - - get_time( timeStart ); - - for i := 1 to loops do - begin - evaluated := 0; { once per loop to prevent overflow } - runit( 0 ); - runit( 1 ); - runit( 4 ); - end; - - get_time( timeEnd ); - print_elapsed_time( timeStart, timeEnd ); - WriteLn( 'moves evaluated: ', evaluated ); - end; - - WriteLn( 'iterations: ', loops ); -end. - \ No newline at end of file +{ App to prove you can't win at Tic-Tac-Toe } + +{ If this flag isn't set, recursion doesn't work on CP/M } +{$A-} +{ This flag turns off checking if the recursion stack and heap collide } +{$K-} + +program ttt; +{$I timeutil.pas} +{$I cpm_gt.pas } + +const + scoreWin = 6; + scoreTie = 5; + scoreLose = 4; + scoreMax = 9; + scoreMin = 2; + scoreInvalid = 0; + + pieceBlank = 0; + pieceX = 1; + pieceO = 2; + + iterations = 1; + +type + boardType = array[ 0..8 ] of integer; + CommandString = string[127]; + +var + evaluated: integer; + board: boardType; + timeStart, timeEnd: timetype; + +procedure dumpBoard; +var + i : integer; +begin + Write( '{' ); + for i := 0 to 8 do + Write( board[i] ); + Write( '}' ); +end; + +function lookForWinner : integer; +var + t, p : integer; +begin + {dumpBoard;} + p := pieceBlank; + t := board[ 0 ]; + if pieceBlank <> t then + begin + if ( ( ( t = board[1] ) and ( t = board[2] ) ) or + ( ( t = board[3] ) and ( t = board[6] ) ) ) then + p := t; + end; + + if pieceBlank = p then + begin + t := board[1]; + if ( t = board[4] ) and ( t = board[7] ) then + p := t + else + begin + t := board[2]; + if ( t = board[5] ) and ( t = board[8] ) then + p := t + else + begin + t := board[3]; + if ( t = board[4] ) and ( t = board[5] ) then + p := t + else + begin + t := board[6]; + if ( t = board[7] ) and ( t = board[8] ) then + p := t + else + begin + t := board[4]; + if ( ( ( t = board[0] ) and ( t = board[8] ) ) or + ( ( t = board[2] ) and ( t = board[6] ) ) ) then + p := t + end; + end; + end; + end; + end; + + lookForWinner := p; +end; + +function winner2( move: integer ) : integer; +var + x : integer; +begin + case move of + 0: begin + x := board[ 0 ]; + if not ( ( ( x = board[1] ) and ( x = board[2] ) ) or + ( ( x = board[3] ) and ( x = board[6] ) ) or + ( ( x = board[4] ) and ( x = board[8] ) ) ) + then x := PieceBlank; + end; + 1: begin + x := board[ 1 ]; + if not ( ( ( x = board[0] ) and ( x = board[2] ) ) or + ( ( x = board[4] ) and ( x = board[7] ) ) ) + then x := PieceBlank; + end; + 2: begin + x := board[ 2 ]; + if not ( ( ( x = board[0] ) and ( x = board[1] ) ) or + ( ( x = board[5] ) and ( x = board[8] ) ) or + ( ( x = board[4] ) and ( x = board[6] ) ) ) + then x := PieceBlank; + end; + 3: begin + x := board[ 3 ]; + if not ( ( ( x = board[4] ) and ( x = board[5] ) ) or + ( ( x = board[0] ) and ( x = board[6] ) ) ) + then x := PieceBlank; + end; + 4: begin + x := board[ 4 ]; + if not ( ( ( x = board[0] ) and ( x = board[8] ) ) or + ( ( x = board[2] ) and ( x = board[6] ) ) or + ( ( x = board[1] ) and ( x = board[7] ) ) or + ( ( x = board[3] ) and ( x = board[5] ) ) ) + then x := PieceBlank; + end; + 5: begin + x := board[ 5 ]; + if not ( ( ( x = board[3] ) and ( x = board[4] ) ) or + ( ( x = board[2] ) and ( x = board[8] ) ) ) + then x := PieceBlank; + end; + 6: begin + x := board[ 6 ]; + if not ( ( ( x = board[7] ) and ( x = board[8] ) ) or + ( ( x = board[0] ) and ( x = board[3] ) ) or + ( ( x = board[4] ) and ( x = board[2] ) ) ) + then x := PieceBlank; + end; + 7: begin + x := board[ 7 ]; + if not ( ( ( x = board[6] ) and ( x = board[8] ) ) or + ( ( x = board[1] ) and ( x = board[4] ) ) ) + then x := PieceBlank; + end; + 8: begin + x := board[ 8 ]; + if not ( ( ( x = board[6] ) and ( x = board[7] ) ) or + ( ( x = board[2] ) and ( x = board[5] ) ) or + ( ( x = board[0] ) and ( x = board[4] ) ) ) + then x := PieceBlank; + end; + end; + + winner2 := x; +end; + +function minmax( alpha: integer; beta: integer; depth: integer; move: integer ): integer; +var + p, value, pieceMove, score : integer; +begin + evaluated := evaluated + 1; + value := scoreInvalid; + if depth >= 4 then + begin + { p := lookForWinner; } { this is much slower } + p := winner2( move ); + if p <> pieceBlank then + begin + if p = pieceX then + value := scoreWin + else + value := scoreLose + end + else if depth = 8 then + value := scoreTie; + end; + + if value = scoreInvalid then + begin + if Odd( depth ) then + begin + value := scoreMin; + pieceMove := pieceX; + end + else + begin + value := scoreMax; + pieceMove := pieceO; + end; + + p := 0; + repeat + if board[ p ] = pieceBlank then + begin + board[ p ] := pieceMove; + score := minmax( alpha, beta, depth + 1, p ); + board[ p ] := pieceBlank; + + if Odd( depth ) then + begin + if ( score > value ) then + begin + value := score; + if ( value = scoreWin ) or ( value >= beta ) then p := 10 + else if ( value > alpha ) then alpha := value; + end; + end + else + begin + if ( score < value ) then + begin + value := score; + if ( value = scoreLose ) or ( value <= alpha ) then p := 10 + else if ( value < beta ) then beta := value; + end; + end; + end; + p := p + 1; + until p > 8; + end; + + minmax := value; +end; + +procedure runit( move : integer ); +var + score: integer; +begin + board[move] := pieceX; + score := minmax( scoreMin, scoreMax, 0, move ); + board[move] := pieceBlank; +end; + +function Trim( intext : CommandString ): CommandString; +var FirstPos, LastPos: integer; +begin + FirstPos := 1; + while ( FirstPos <= Length( intext ) ) and ( intext[FirstPos] = #32 ) do + FirstPos := FirstPos + 1; + + LastPos := Length( intext ); + while ( LastPos >= 1 ) and ( intext[LastPos] = #32 ) do + LastPos := LastPos - 1; + + Trim := Copy( intext, FirstPos, LastPos - FirstPos + 1 ); +end; + +var + i, loops, code: integer; + strArg : CommandString; + cmdTail : CommandString absolute $80; +begin + loops := Iterations; + + { on cp/m 2.2 the length is 1 for no arguments -- it's just a space } + + if ( mem[ 128 ] > 1 ) then + begin + { trim the space at the start that's always there } + + strArg := Trim( cmdTail ); + Val( strArg, loops, code ); + end; + + if ( loops > 0 ) then + begin + for i := 0 to 8 do + board[i] := pieceBlank; + + get_time( timeStart ); + + for i := 1 to loops do + begin + evaluated := 0; { once per loop to prevent overflow } + runit( 0 ); + runit( 1 ); + runit( 4 ); + end; + + get_time( timeEnd ); + print_elapsed_time( timeStart, timeEnd ); + WriteLn( 'moves evaluated: ', evaluated ); + end; + + WriteLn( 'iterations: ', loops ); +end. diff --git a/turbo3_cpm/TTT-CPM.PAS b/turbo3_cpm/TTT-CPM.PAS index d5f4ac0..76089de 100644 --- a/turbo3_cpm/TTT-CPM.PAS +++ b/turbo3_cpm/TTT-CPM.PAS @@ -1,223 +1,293 @@ -{ App to prove you can't win at Tic-Tac-Toe } - -{ If this flag isn't set, recursion doesn't work on CP/M } -{$A-} -{ This flag turns off checking if the recursion stack and heap collide } -{$K-} - -program ttt; -{$I timeutil.pas} -{$I cpm_gt.pas } - -const - scoreWin = 6; - scoreTie = 5; - scoreLose = 4; - scoreMax = 9; - scoreMin = 2; - scoreInvalid = 0; - - pieceBlank = 0; - pieceX = 1; - pieceO = 2; - - iterations = 1; - -type - boardType = array[ 0..8 ] of integer; - CommandString = string[127]; - -var - evaluated: integer; - board: boardType; - timeStart, timeEnd: timetype; - -procedure dumpBoard; -var - i : integer; -begin - Write( '{' ); - for i := 0 to 8 do - Write( board[i] ); - Write( '}' ); -end; - -function lookForWinner : integer; -var - t, p : integer; -begin - {dumpBoard;} - p := pieceBlank; - t := board[ 0 ]; - if pieceBlank <> t then - begin - if ( ( ( t = board[1] ) and ( t = board[2] ) ) or - ( ( t = board[3] ) and ( t = board[6] ) ) ) then - p := t; - end; - - if pieceBlank = p then - begin - t := board[1]; - if ( t = board[4] ) and ( t = board[7] ) then - p := t - else - begin - t := board[2]; - if ( t = board[5] ) and ( t = board[8] ) then - p := t - else - begin - t := board[3]; - if ( t = board[4] ) and ( t = board[5] ) then - p := t - else - begin - t := board[6]; - if ( t = board[7] ) and ( t = board[8] ) then - p := t - else - begin - t := board[4]; - if ( ( ( t = board[0] ) and ( t = board[8] ) ) or - ( ( t = board[2] ) and ( t = board[6] ) ) ) then - p := t - end; - end; - end; - end; - end; - - lookForWinner := p; -end; - -function minmax( alpha: integer; beta: integer; depth: integer ): integer; -var - p, value, pieceMove, score : integer; -begin - evaluated := evaluated + 1; - value := scoreInvalid; - if depth >= 4 then - begin - p := lookForWinner; - if p <> pieceBlank then - begin - if p = pieceX then - value := scoreWin - else - value := scoreLose - end - else if depth = 8 then - value := scoreTie; - end; - - if value = scoreInvalid then - begin - if Odd( depth ) then - begin - value := scoreMin; - pieceMove := pieceX; - end - else - begin - value := scoreMax; - pieceMove := pieceO; - end; - - p := 0; - repeat - if board[ p ] = pieceBlank then - begin - board[ p ] := pieceMove; - score := minmax( alpha, beta, depth + 1 ); - board[ p ] := pieceBlank; - - if Odd( depth ) then - begin - if ( score > value ) then - begin - value := score; - if ( value = scoreWin ) or ( value >= beta ) then p := 10 - else if ( value > alpha ) then alpha := value; - end; - end - else - begin - if ( score < value ) then - begin - value := score; - if ( value = scoreLose ) or ( value <= alpha ) then p := 10 - else if ( value < beta ) then beta := value; - end; - end; - end; - p := p + 1; - until p > 8; - end; - - minmax := value; -end; - -procedure runit( move : integer ); -var - score: integer; -begin - board[move] := pieceX; - score := minmax( scoreMin, scoreMax, 0 ); - board[move] := pieceBlank; -end; - -function Trim( intext : CommandString ): CommandString; -var FirstPos, LastPos: integer; -begin - FirstPos := 1; - while ( FirstPos <= Length( intext ) ) and ( intext[FirstPos] = #32 ) do - FirstPos := FirstPos + 1; - - LastPos := Length( intext ); - while ( LastPos >= 1 ) and ( intext[LastPos] = #32 ) do - LastPos := LastPos - 1; - - Trim := Copy( intext, FirstPos, LastPos - FirstPos + 1 ); -end; - -var - i, loops, code: integer; - strArg : CommandString; - cmdTail : CommandString absolute $80; -begin - loops := Iterations; - - { on cp/m 2.2 the length is 1 for no arguments -- it's just a space } - - if ( mem[ 128 ] > 1 ) then - begin - { trim the space at the start that's always there } - - strArg := Trim( cmdTail ); - Val( strArg, loops, code ); - end; - - if ( loops > 0 ) then - begin - for i := 0 to 8 do - board[i] := pieceBlank; - - get_time( timeStart ); - - for i := 1 to loops do - begin - evaluated := 0; { once per loop to prevent overflow } - runit( 0 ); - runit( 1 ); - runit( 4 ); - end; - - get_time( timeEnd ); - print_elapsed_time( timeStart, timeEnd ); - WriteLn( 'moves evaluated: ', evaluated ); - end; - - WriteLn( 'iterations: ', loops ); -end. - \ No newline at end of file +{ App to prove you can't win at Tic-Tac-Toe } + +{ If this flag isn't set, recursion doesn't work on CP/M } +{$A-} +{ This flag turns off checking if the recursion stack and heap collide } +{$K-} + +program ttt; +{$I timeutil.pas} +{$I cpm_gt.pas } + +const + scoreWin = 6; + scoreTie = 5; + scoreLose = 4; + scoreMax = 9; + scoreMin = 2; + scoreInvalid = 0; + + pieceBlank = 0; + pieceX = 1; + pieceO = 2; + + iterations = 1; + +type + boardType = array[ 0..8 ] of integer; + CommandString = string[127]; + +var + evaluated: integer; + board: boardType; + timeStart, timeEnd: timetype; + +procedure dumpBoard; +var + i : integer; +begin + Write( '{' ); + for i := 0 to 8 do + Write( board[i] ); + Write( '}' ); +end; + +function lookForWinner : integer; +var + t, p : integer; +begin + {dumpBoard;} + p := pieceBlank; + t := board[ 0 ]; + if pieceBlank <> t then + begin + if ( ( ( t = board[1] ) and ( t = board[2] ) ) or + ( ( t = board[3] ) and ( t = board[6] ) ) ) then + p := t; + end; + + if pieceBlank = p then + begin + t := board[1]; + if ( t = board[4] ) and ( t = board[7] ) then + p := t + else + begin + t := board[2]; + if ( t = board[5] ) and ( t = board[8] ) then + p := t + else + begin + t := board[3]; + if ( t = board[4] ) and ( t = board[5] ) then + p := t + else + begin + t := board[6]; + if ( t = board[7] ) and ( t = board[8] ) then + p := t + else + begin + t := board[4]; + if ( ( ( t = board[0] ) and ( t = board[8] ) ) or + ( ( t = board[2] ) and ( t = board[6] ) ) ) then + p := t + end; + end; + end; + end; + end; + + lookForWinner := p; +end; + +function winner2( move: integer ) : integer; +var + x : integer; +begin + case move of + 0: begin + x := board[ 0 ]; + if not ( ( ( x = board[1] ) and ( x = board[2] ) ) or + ( ( x = board[3] ) and ( x = board[6] ) ) or + ( ( x = board[4] ) and ( x = board[8] ) ) ) + then x := PieceBlank; + end; + 1: begin + x := board[ 1 ]; + if not ( ( ( x = board[0] ) and ( x = board[2] ) ) or + ( ( x = board[4] ) and ( x = board[7] ) ) ) + then x := PieceBlank; + end; + 2: begin + x := board[ 2 ]; + if not ( ( ( x = board[0] ) and ( x = board[1] ) ) or + ( ( x = board[5] ) and ( x = board[8] ) ) or + ( ( x = board[4] ) and ( x = board[6] ) ) ) + then x := PieceBlank; + end; + 3: begin + x := board[ 3 ]; + if not ( ( ( x = board[4] ) and ( x = board[5] ) ) or + ( ( x = board[0] ) and ( x = board[6] ) ) ) + then x := PieceBlank; + end; + 4: begin + x := board[ 4 ]; + if not ( ( ( x = board[0] ) and ( x = board[8] ) ) or + ( ( x = board[2] ) and ( x = board[6] ) ) or + ( ( x = board[1] ) and ( x = board[7] ) ) or + ( ( x = board[3] ) and ( x = board[5] ) ) ) + then x := PieceBlank; + end; + 5: begin + x := board[ 5 ]; + if not ( ( ( x = board[3] ) and ( x = board[4] ) ) or + ( ( x = board[2] ) and ( x = board[8] ) ) ) + then x := PieceBlank; + end; + 6: begin + x := board[ 6 ]; + if not ( ( ( x = board[7] ) and ( x = board[8] ) ) or + ( ( x = board[0] ) and ( x = board[3] ) ) or + ( ( x = board[4] ) and ( x = board[2] ) ) ) + then x := PieceBlank; + end; + 7: begin + x := board[ 7 ]; + if not ( ( ( x = board[6] ) and ( x = board[8] ) ) or + ( ( x = board[1] ) and ( x = board[4] ) ) ) + then x := PieceBlank; + end; + 8: begin + x := board[ 8 ]; + if not ( ( ( x = board[6] ) and ( x = board[7] ) ) or + ( ( x = board[2] ) and ( x = board[5] ) ) or + ( ( x = board[0] ) and ( x = board[4] ) ) ) + then x := PieceBlank; + end; + end; + + winner2 := x; +end; + +function minmax( alpha: integer; beta: integer; depth: integer; move: integer ): integer; +var + p, value, pieceMove, score : integer; +begin + evaluated := evaluated + 1; + value := scoreInvalid; + if depth >= 4 then + begin + { p := lookForWinner; } { this is much slower } + p := winner2( move ); + if p <> pieceBlank then + begin + if p = pieceX then + value := scoreWin + else + value := scoreLose + end + else if depth = 8 then + value := scoreTie; + end; + + if value = scoreInvalid then + begin + if Odd( depth ) then + begin + value := scoreMin; + pieceMove := pieceX; + end + else + begin + value := scoreMax; + pieceMove := pieceO; + end; + + p := 0; + repeat + if board[ p ] = pieceBlank then + begin + board[ p ] := pieceMove; + score := minmax( alpha, beta, depth + 1, p ); + board[ p ] := pieceBlank; + + if Odd( depth ) then + begin + if ( score > value ) then + begin + value := score; + if ( value = scoreWin ) or ( value >= beta ) then p := 10 + else if ( value > alpha ) then alpha := value; + end; + end + else + begin + if ( score < value ) then + begin + value := score; + if ( value = scoreLose ) or ( value <= alpha ) then p := 10 + else if ( value < beta ) then beta := value; + end; + end; + end; + p := p + 1; + until p > 8; + end; + + minmax := value; +end; + +procedure runit( move : integer ); +var + score: integer; +begin + board[move] := pieceX; + score := minmax( scoreMin, scoreMax, 0, move ); + board[move] := pieceBlank; +end; + +function Trim( intext : CommandString ): CommandString; +var FirstPos, LastPos: integer; +begin + FirstPos := 1; + while ( FirstPos <= Length( intext ) ) and ( intext[FirstPos] = #32 ) do + FirstPos := FirstPos + 1; + + LastPos := Length( intext ); + while ( LastPos >= 1 ) and ( intext[LastPos] = #32 ) do + LastPos := LastPos - 1; + + Trim := Copy( intext, FirstPos, LastPos - FirstPos + 1 ); +end; + +var + i, loops, code: integer; + strArg : CommandString; + cmdTail : CommandString absolute $80; +begin + loops := Iterations; + + { on cp/m 2.2 the length is 1 for no arguments -- it's just a space } + + if ( mem[ 128 ] > 1 ) then + begin + { trim the space at the start that's always there } + + strArg := Trim( cmdTail ); + Val( strArg, loops, code ); + end; + + if ( loops > 0 ) then + begin + for i := 0 to 8 do + board[i] := pieceBlank; + + get_time( timeStart ); + + for i := 1 to loops do + begin + evaluated := 0; { once per loop to prevent overflow } + runit( 0 ); + runit( 1 ); + runit( 4 ); + end; + + get_time( timeEnd ); + print_elapsed_time( timeStart, timeEnd ); + WriteLn( 'moves evaluated: ', evaluated ); + end; + + WriteLn( 'iterations: ', loops ); +end.