Download presentation

Presentation is loading. Please wait.

Published byLinette Hunt Modified over 2 years ago

1
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207 paul.gibson@it-sudparis.eu http://www-public.it-sudparis.eu/~gibson/Teaching/MAT7003/ XO Sample Answer

2
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.2 TO DO - Probability and statistics for game analysis In a game of noughts and crosses. If 2 players play completely randomly (correctly following the rules of the game, but showing no other intelligence regarding where/how to play at each turn) then : What is the probability that the player who starts wins the game? What is probability that the player who goes second wins the game? What is probability that the game ends in a draw? Calculate the probabilities (+/- 0.1), and test your answer through a computer simulation

3
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.3 Number of random games = 1000000 Number of wins for X (starting)= 585649 Number of wins for O (second) = 287073 My results by Java simulation of random game 1 million times My results by Java simulation of all possible games: Number of games = 362880 Number of wins for X (starting)= 212256 Number of wins for O (second) = 104544 Wins after rounds = 5 : 34560 6 : 31968 7 : 95904 8 : 72576 9 : 81792 Prob(X wins) = 0.5849 Prob(O wins) = 0.2881 Prob(draw) = 0,127 NOTE: I did not simplify for symmetry

4
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.4 do{ permutation =gameIterator.next(); XOBoard game = new XOBoard(); gameCount++; gameOver = false; game = new XOBoard(); int playCount =0; do { game.playX(permutation[playCount]+1); playCount++; if (game.checkFull() || game.checkWinX()) gameOver = true; if (!gameOver){ game.playO(permutation[playCount]+1); playCount++; if (game.checkFull() || game.checkWinO()) gameOver = true; } } while (!gameOver); if (game.checkWinX() ) {winXCount++; winCount[playCount]++;} if (game.checkWinO() ) {winOCount++; winCount[playCount]++;} gameOver = false; } while (gameIterator.hasNext() && !gameOver); Test_Complete_Play.java (main algorithm)

5
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.5 int winXCount =0; int winOCount =0; int NUMBER_GAMES = 1000000; boolean gameOver = false; XOBoard game = new XOBoard(); XORandomPlay rules = new XORandomPlay(); for (int gamecount =0; gamecount< NUMBER_GAMES; gamecount++){ gameOver = false; game = new XOBoard(); do { rules.apply(game, 'X'); if (game.checkFull() || game.checkWinX()) gameOver = true; if (!gameOver){ rules.apply(game, 'O'); if (game.checkFull() || game.checkWinO()) gameOver = true; } } while (!gameOver); if (game.checkWinX() ) winXCount++; if (game.checkWinO() ) winOCount++; } Test_Statistics_RandomPlay.java (main algorithm)

6
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.6 Probabilistic Analysis Has Been Published Elsewhere: Scientific American, Mathematical Recreations, Tic-Tac-Toe (January 2002) Steve Schaefer http://www.mathrec.org/old/2002jan/solutions.html How many Tic-Tac-Toe (noughts and crosses) games are possible? http://www.se16.info/hgb/tictactoe.htm Henry Bottomley

Similar presentations

OK

Our project main purpose is to develop a tool for a combinatorial game researcher. Given a version of combinatorial puzzle game and few more parameters,

Our project main purpose is to develop a tool for a combinatorial game researcher. Given a version of combinatorial puzzle game and few more parameters,

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on history of computer virus Ppt on job evaluation process Ppt on email etiquettes presentation Ppt on review of related literature introduction Ppt on waxes biology Ppt on bluetooth technology download Ppt on panel discussion questions Ppt on role of individual in conservation of natural resources Ppt on indian politics powerpoint Ppt on barack obama leadership and legacy