Hii all .. i wrote an XO game code but i cant end the program when a player wins before entering all the elements any ideas ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hii all .. i wrote an XO game code but i cant end the program when a player wins before entering all the elements any ideas ??

16th Nov 2016, 9:20 PM
Mohammad Akel
Mohammad Akel - avatar
2 Answers
+ 2
If you use 3×3 matrix, you should check if there is three equal symbol in a row, column or diagonal, every time after a player finished his turn. You also can do it with any n×n matrix
16th Nov 2016, 10:09 PM
Marcell Juhasz
0
i wrote a function that tests if a player wins but my prob is that ahen a players wins the code continues till all my 3*3 elements are entered ..
16th Nov 2016, 10:15 PM
Mohammad Akel
Mohammad Akel - avatar