File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -284,9 +284,9 @@ class DraughtsBoard {
284284 if ( j > 0 ) {
285285 buf += ' '
286286 }
287- if ( this . _board [ i ] [ j ] === RED ) {
287+ if ( this . _board [ i ] [ j ] & RED ) {
288288 buf += 'x'
289- } else if ( this . _board [ i ] [ j ] === WHITE ) {
289+ } else if ( this . _board [ i ] [ j ] & WHITE ) {
290290 buf += 'o'
291291 } else {
292292 buf += '-'
@@ -298,19 +298,13 @@ class DraughtsBoard {
298298 }
299299
300300 nextTurn ( turn ) {
301- if ( turn === WHITE ) {
302- return RED
303- } else {
304- return WHITE
305- }
301+ return turn === WHITE ? RED : WHITE
306302 }
307303
308304 copy ( ) {
309305 const cp = new DraughtsBoard ( this . _size , this . _evaluator )
310306 for ( let i = 0 ; i < this . _size [ 0 ] ; i ++ ) {
311- for ( let j = 0 ; j < this . _size [ 1 ] ; j ++ ) {
312- cp . _board [ i ] [ j ] = this . _board [ i ] [ j ]
313- }
307+ cp . _board [ i ] = this . _board [ i ] . concat ( )
314308 }
315309 return cp
316310 }
You can’t perform that action at this time.
0 commit comments