46 Tic-Tac-Toe one in 17 answers is wrong What am I missing?

Back to Problem Solutions forum

flaxferrari     2016-10-04 22:09:01

http://www.codeabbey.com/index/task_solution?user=fravioferrari&task=tic-tac-toe&lang=Python

Tried to post the code, but format was rubbish.

I already spent several hours looking for a mistke, but couldnt find yet. So fresh eyes are welcome.

flaxferrari     2016-10-05 17:26:10

Well, the problem was that: disregard player1 is analysed first, IF the second player could win in the same round AND the [list of winners] have the (win player1 numbers) at the end of array... the bug will manifestate. P2 will win because his numbers are in the begining of [list of winners]. The chance of this occour is 1/8. So 16 answers right for 1 wrong kind of agree probabilisticaly.

I used this tool to visualize what was wrong: Interesting debug site http://www.pythontutor.com/visualize.html#togetherjs=jwdQHq1Tqs

Please login and solve 5 problems to be able to post at forum