'else if being inconsistent
I've been making a simple tic-tac-toe game wherein to check whether a player crossed out a row I've made the following logic:
::board
echo %one% ^| %two% ^| %three%
echo ---------
echo %four% ^| %five% ^| %six%
echo ---------
echo %seven% ^| %eight% ^| %nine%
echo.
::rows
if %one% NEQ - (
if %one% EQU %two% (
if %two% EQU %three% (
goto endGame
)
)
) else if %four% NEQ - (
if %four% EQU %five% (
if %five% EQU %six% (
goto endGame
)
)
) else if %seven% NEQ - (
if %seven% EQU %eight% (
if %eight% EQU %nine% (
goto endGame
)
)
)
However, this seems inconsistent as to when the rows including one-two-three & four-five-six get crossed off, the game ends, although for the final row the logic fails.
A similar inconsistency follows for the columns.
Can someone help me understand why so?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
