Hello,
Me and a friend is doing a 3 in a row game with an AI opponent as a school project and have a problem with the leds not working as they should. We have tested the circuit and there is no problem with it, and the problem lays within the code.
Here is the circuit: Circuit - Album on Imgur
Video of problem: problem - YouTube
The 9 buttons represent the 9 cordinates on the board and if you click the first one the top left corner it will turn on the blue led on the top left and then the AI will randomize an empty cordinate and place it there. However for some reason if the ai places an red led on a row (x-axis) all of the players blue leds will turn off on that row. However they are still registered and the game will detect a win although they are not turned on. The problem does not occur at the columns (y-axis).
Code: // RÖDA LEDS int R1K1Red = 28; int R1K2Red = 2; int R1K3Red = 3; - Pastebin.com
The variable and function names is in swedish but essentially. Rad = row, Kolumn = Column, Röd = Red and Blå = Blue.
I strongly believe the problem lies within the function void uppdateraLampor() but I cannot understand what causes it. If you need any other information please just tell me and i'll reply with it.
Any help appreciated.