MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / playTicTacToe_testGameSomeoneWon

Method playTicTacToe_testGameSomeoneWon

code/main/ATree.ts:287–314  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285 }
286
287 private playTicTacToe_testGameSomeoneWon(): ATreeTicTacToeSign{
288 // Variables
289 var returnSign: ATreeTicTacToeSign;
290
291 for(var i = 0; i < 5; i++){
292 returnSign = this.playTicTacToe_fiveInARow(i, 0, 0, 1);
293 if(returnSign != null) return returnSign;
294 }
295
296 for(var i = 0; i < 5; i++){
297 returnSign = this.playTicTacToe_fiveInARow(0, i, 1, 0);
298 if(returnSign != null) return returnSign;
299 }
300
301 if((returnSign = this.playTicTacToe_fiveInARow(0, 0, 1, 1)) != null) return returnSign;
302 if((returnSign = this.playTicTacToe_fiveInARow(0, 1, 1, 1)) != null) return returnSign;
303 if((returnSign = this.playTicTacToe_fiveInARow(1, 0, 1, 1)) != null) return returnSign;
304 if((returnSign = this.playTicTacToe_fiveInARow(0, 2, 1, 1)) != null) return returnSign;
305 if((returnSign = this.playTicTacToe_fiveInARow(2, 0, 1, 1)) != null) return returnSign;
306 if((returnSign = this.playTicTacToe_fiveInARow(4, 0, -1, 1)) != null) return returnSign;
307 if((returnSign = this.playTicTacToe_fiveInARow(3, 1, -1, 1)) != null) return returnSign;
308 if((returnSign = this.playTicTacToe_fiveInARow(3, 0, -1, 1)) != null) return returnSign;
309 if((returnSign = this.playTicTacToe_fiveInARow(4, 2, -1, 1)) != null) return returnSign;
310 if((returnSign = this.playTicTacToe_fiveInARow(2, 0, -1, 1)) != null) return returnSign;
311
312 // No won won, we return NO_SIGN
313 return ATreeTicTacToeSign.NO_SIGN;
314 }
315
316 private playTicTacToe_fiveInARow(x1: number, y1: number, x2: number, y2: number): ATreeTicTacToeSign{
317 // Variables

Calls 1

Tested by

no test coverage detected