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

Method playTicTacToe_testEndGameConditions

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

Source from the content-addressed store, hash-verified

236 }
237
238 private playTicTacToe_testEndGameConditions(): boolean{
239 // Variables
240 var shouldEnd: boolean = false;
241
242 // Test if someone won (in the 5*5 grid)
243 switch(this.playTicTacToe_testGameSomeoneWon()){
244 case ATreeTicTacToeSign.O: // The squirrel won
245 this.ticTacToeStep = ATreeTicTacToeStep.YOU_LOSE;
246 return true;
247 break;
248 case ATreeTicTacToeSign.X: // The player won
249 // add object to the player here
250 this.nextStep();
251 return true;
252 break;
253 }
254
255 // Test if the game is full (in the 3*3 grid)
256 if(this.playTicTacToe_testGameFull()){ // It's a draw
257 this.ticTacToeStep = ATreeTicTacToeStep.NOBODY_WINS;
258 return true;
259 }
260
261 // Nothing happens, we return false
262 return false;
263 }
264
265 private playTicTacToe_testGameFull(): boolean{
266 // Variables

Callers 1

playTicTacToeSignMethod · 0.95

Calls 3

nextStepMethod · 0.95

Tested by

no test coverage detected