Post by Kristal Rose Phoenix McKinstry on Oct 15, 2005 6:47:39 GMT -5
chess.php is as simple two player on-line chess game, although the server can handle a queue of multiple players each waiting to pair off for games.
It consists of one screen with the following elements
1. Text header report from server. Messages my contain:
"Please enter a name and press [log-in]."
"Please wait for other players to log in."
"Please select a player."
"$player1 has selected you. Since you arrived later, you will be black."
"Ready to play $player2. Since you arrived first, you will be white."
"It's your turn."
"Please wait for other player to move."
"Invalid move. Please try again."
"Invalid move. You did not declare 'Check'."
"Invalid move. You did not declare 'Check-mate'."
"Congratulations. You have won. Please log-out or select a player."
2. Game sub-form
2.1.1 Player text field
2.1.2 'Log-in' button
2.1.3 'Log-out' button
2.2.1 Menu to select from available partners
2.2.2 Select button
2.3 Text-field (integer seconds) to set screen refresh
3. Move sub-form
3.1.1 Move-from column radio a-h
3.1.2 Move-from row radio 1-8
3.2.1 Move-to column radio a-h
3.2.2 Move-to row radio 1-8
3.3 Special move Menu (castle, etc)
3.4 Declaration ('none("Special Moves..") / "castle-short" / "castle-long" / "declare-check" / "declare-checkmate'")
3.5 Submit move button [automated instead through javascript]
4. A chess board table (8 col, 8 row) filled with css colored cells and transparent-space gif chess pieces.
A game consists of two arrays, one to keep track of players and turns, and another containing the current placement of pieces.
When moves are submitted, pieces are moved in the array accordingly.
The game object has methods like test_move, commit_move, and get_player_two_array (because the game would otherwise be upside down for player two.)
The application screen (chess.php) calls update methods any time a submit button is clicked. It also refreshes automatically every 20 seconds or so at which point it polls the game database to see if any changes have been submitted from the other player, and then resets page data and redisplays accordingly.
The first player is white.
An optional table can display claimed pieces
It consists of one screen with the following elements
1. Text header report from server. Messages my contain:
"Please enter a name and press [log-in]."
"Please wait for other players to log in."
"Please select a player."
"$player1 has selected you. Since you arrived later, you will be black."
"Ready to play $player2. Since you arrived first, you will be white."
"It's your turn."
"Please wait for other player to move."
"Invalid move. Please try again."
"Invalid move. You did not declare 'Check'."
"Invalid move. You did not declare 'Check-mate'."
"Congratulations. You have won. Please log-out or select a player."
2. Game sub-form
2.1.1 Player text field
2.1.2 'Log-in' button
2.1.3 'Log-out' button
2.2.1 Menu to select from available partners
2.2.2 Select button
2.3 Text-field (integer seconds) to set screen refresh
3. Move sub-form
3.1.1 Move-from column radio a-h
3.1.2 Move-from row radio 1-8
3.2.1 Move-to column radio a-h
3.2.2 Move-to row radio 1-8
3.3 Special move Menu (castle, etc)
3.4 Declaration ('none("Special Moves..") / "castle-short" / "castle-long" / "declare-check" / "declare-checkmate'")
3.5 Submit move button [automated instead through javascript]
4. A chess board table (8 col, 8 row) filled with css colored cells and transparent-space gif chess pieces.
A game consists of two arrays, one to keep track of players and turns, and another containing the current placement of pieces.
When moves are submitted, pieces are moved in the array accordingly.
The game object has methods like test_move, commit_move, and get_player_two_array (because the game would otherwise be upside down for player two.)
The application screen (chess.php) calls update methods any time a submit button is clicked. It also refreshes automatically every 20 seconds or so at which point it polls the game database to see if any changes have been submitted from the other player, and then resets page data and redisplays accordingly.
The first player is white.
An optional table can display claimed pieces