Hi,
I designed a game loop for my othello program. I used a new approach, but i still felt it might contain something illogical. Can i ask you to hava quick look at it and spot out any obvious errors? You know, other ppl tend to see errors more quickly ^.^
Code:
Main game loop
------------------------------------------------------------------------------------
display splash
print board and other visual elements
ask for game mode, single, 2-player or demo-play
if ( mode == 1 )
ask for difficulty
flip coin, decide who moves first, b or w (human player is always black)
while ( gameEnd == false )
display orange new piece
if ( gameMode == 1 || gameMode == 2 )
if no legal moves for currentPlayer
pass
else
get move until a legal move is chosen
make move, flipping pieces
else if ( gameMode == 0 )
if no legal moves for currentPlayer
pass
else
make move using minimax algorithm
change current player
update score
check game ended? If yes gameEnd = true, display scores and winner
when ESC key is pressed, gameEnd = true
ask if start a new game
if yes goto newGame;
end program