@@ -31,7 +31,7 @@ class MoveSearcher(val board: GomokuBoard) {
3131 board.total_size / 2
3232 }
3333 }
34-
34+
3535 def findPossibleMoves (): GrowableArray [Int ] = {
3636 import LineInfo ._
3737
@@ -67,7 +67,7 @@ class MoveSearcher(val board: GomokuBoard) {
6767 cell += 1
6868 }
6969 }
70- // if (li(player, 3, ))
70+ // if (li(player, 3, ))
7171 val th3 = li(- player, 3 , OPEN ) + li(- player, 3 , BROKEN )
7272 if (li(player, 3 ) == 0 && th3 > 0 ) {
7373 board.withMove(_)(() => {
@@ -96,7 +96,7 @@ class MoveSearcher(val board: GomokuBoard) {
9696 * simple score, with hash lookup
9797 */
9898 def getSimpleScore () = {
99- board.heur_score()
99+ board.heur_score()
100100 }
101101
102102 /**
@@ -119,24 +119,21 @@ class MoveSearcher(val board: GomokuBoard) {
119119 if (moves.length == 0 ) throw new Error (" This should not happen! No available moves." )
120120 moves.sortByInplace(test_move_heur)
121121 if (board.pieces == 1 ) moves.trim(2 )
122- if (moves.head <= - LineInfo .WIN ) moves.head
123- else {
124- var bestmove = 0
125- var bestscore = alpha
126- @ inline def loop (i : Int ): Int = {
127- if (i < moves.length) {
128- val recursedscore : Int = - search_score(moves(i), depth, - b, - bestscore)
129- if (recursedscore > bestscore) {
130- bestscore = recursedscore
131- bestmove = moves(i)
132- }
133- if (bestscore >= LineInfo .WIN1 ) {
134- bestmove
135- } else loop(i + 1 )
136- } else bestmove
137- }
138- loop(0 )
122+ var bestmove = 0
123+ var bestscore = alpha
124+ @ inline def loop (i : Int ): Int = {
125+ if (i < moves.length) {
126+ val recursedscore : Int = - search_score(moves(i), depth, - b, - bestscore)
127+ if (recursedscore > bestscore) {
128+ bestscore = recursedscore
129+ bestmove = moves(i)
130+ }
131+ if (bestscore >= LineInfo .WIN1 ) {
132+ bestmove
133+ } else loop(i + 1 )
134+ } else bestmove
139135 }
136+ loop(0 )
140137 }
141138
142139 /**
@@ -161,8 +158,7 @@ class MoveSearcher(val board: GomokuBoard) {
161158 val result =
162159 if (he.hash == board.getHash && he.depth == depth) {
163160 he.score
164- } else
165- {
161+ } else {
166162 val heur = board.heur_score()
167163 if (math.abs(heur) >= LineInfo .WIN1 || depth <= 0 )
168164 heur
0 commit comments