File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -162,18 +162,18 @@ export class EnsoGame extends GameBase {
162162 for ( const dir of allDirections ) {
163163 let ray = g . ray ( fx , fy , dir ) . map ( c => g . coords2algebraic ( ...c ) ) ;
164164 const idx = ray . findIndex ( cell => this . board . has ( cell ) ) ;
165- if ( idx >= 0 ) {
165+ if ( idx > 0 ) {
166166 // this ray only contains contiguous empty spaces leading up
167167 // to the first occupied space
168168 ray = ray . slice ( 0 , idx ) ;
169- for ( const next of ray ) {
170- const cloned = this . clone ( ) ;
171- cloned . board . delete ( pc ) ;
172- cloned . board . set ( next , player ) ;
173- const status = cloned . connStatus ( next ) ;
174- if ( status === "isolated" || status === "enemy" ) {
175- moves . push ( ` ${ pc } - ${ next } ` ) ;
176- }
169+ }
170+ for ( const next of ray ) {
171+ const cloned = this . clone ( ) ;
172+ cloned . board . delete ( pc ) ;
173+ cloned . board . set ( next , player ) ;
174+ const status = cloned . connStatus ( next ) ;
175+ if ( status === "isolated" || status === "enemy" ) {
176+ moves . push ( ` ${ pc } - ${ next } ` ) ;
177177 }
178178 }
179179 }
You can’t perform that action at this time.
0 commit comments