Difference between revisions of "Chess Game Example"
From WeizmannWiki
Line 1: | Line 1: | ||
− | This is a protected page for the Chess Game Example. | + | This is a protected page for the Chess Game Example. |
− | <br> | + | <br> |
== Chess Game Example<br> == | == Chess Game Example<br> == | ||
− | The ChessGameExample | + | The ChessGameExample demonstrate original '''chess''' with a two-player strategy played on a chessboard. The original chess game has lots of rules and regulations most of them are implemented in this example.The game accepts moves through the mouse click on the piece,which is the source, and another click on the target. A source selection highlights valid user moves for target selection. The game can be constructed in different ways, in which two of them are described below. |
== Game Board == | == Game Board == | ||
− | [[Image:ChessScreenShot.png]] | + | [[Image:ChessScreenShot.png]] |
− | <br> | + | <br> |
== Example 1 - LSC for the game == | == Example 1 - LSC for the game == | ||
− | <br> | + | <br> |
{| width="100%" border="1" align="left" cellpadding="1" cellspacing="1" | {| width="100%" border="1" align="left" cellpadding="1" cellspacing="1" | ||
|- | |- | ||
− | ! scope="col" width="15%" | Name | + | ! scope="col" width="15%" | Name |
− | ! scope="col" width="70%" | Description | + | ! scope="col" width="70%" | Description |
! scope="col" width="15%" | LSC | ! scope="col" width="15%" | LSC | ||
|- | |- | ||
− | | Square PieceClick | + | | Square PieceClick |
− | | When the user click any square Sq1, and then click any square Sq2, if the board next turn is equals to the Sq1 piece type then the square Sq1 check_Move square Sq2. | + | | When the user click any square Sq1, and then click any square Sq2, if the board next turn is equals to the Sq1 piece type then the square Sq1 check_Move square Sq2. |
− | | | + | | |
− | [[Image:PieceClick.png|thumb|left|LSC]] | + | [[Image:PieceClick.png|thumb|left|LSC]] |
|- | |- | ||
− | | Square MovePiece | + | | Square MovePiece |
− | | When the square Sq1 check_Move square Sq2, canmove is assigned whether the movement of piece from square Sq1 to Sq2 is possible, if the piece canmove and Sq1 piecetype is not equals to Sq2 piecetype then the square Sq1 move_Piece to square Sq2. | + | | When the square Sq1 check_Move square Sq2, canmove is assigned whether the movement of piece from square Sq1 to Sq2 is possible, if the piece canmove and Sq1 piecetype is not equals to Sq2 piecetype then the square Sq1 move_Piece to square Sq2. |
| [[Image:MovePiece.png|thumb|left|LSC]] | | [[Image:MovePiece.png|thumb|left|LSC]] | ||
|- | |- | ||
− | | Square RemovePiece | + | | Square RemovePiece |
− | | When the square Sq1 move_Piece to square Sq2, then the square Sq2 emptyPiece the square Sq2. | + | | When the square Sq1 move_Piece to square Sq2, then the square Sq2 emptyPiece the square Sq2. |
| [[Image:RemovePiece.png|thumb|left|LSC]] | | [[Image:RemovePiece.png|thumb|left|LSC]] | ||
|- | |- | ||
− | | Square NextMove | + | | Square NextMove |
− | | When the square Sq1 move_Piece to square Sq2, if the board next turn is "white" the board next turn changes to "black" otherwise if the board next turn is "black" the board next turn changes to "white". | + | | When the square Sq1 move_Piece to square Sq2, if the board next turn is "white" the board next turn changes to "black" otherwise if the board next turn is "black" the board next turn changes to "white". |
| [[Image:NextMove.png|thumb|left|LSC]] | | [[Image:NextMove.png|thumb|left|LSC]] | ||
|- | |- | ||
− | | Square SetSource | + | | Square SetSource |
− | | When the user click any square Sq1, if the Issource is "empty" then the square Sq1's possible positions are set and the IsSource changes to "set". | + | | When the user click any square Sq1, if the Issource is "empty" then the square Sq1's possible positions are set and the IsSource changes to "set". |
| [[Image:SetSource.png|thumb|left|LSC]] | | [[Image:SetSource.png|thumb|left|LSC]] | ||
|- | |- | ||
− | | Square ShowMessage | + | | Square ShowMessage |
− | | When the user click any square Sq1, if the square IsSource is "empty" and the board next turn not equals the Sq1 piecetype then the square showmessage and the Issource is set to "empty". | + | | When the user click any square Sq1, if the square IsSource is "empty" and the board next turn not equals the Sq1 piecetype then the square showmessage and the Issource is set to "empty". |
| [[Image:ShowMessage.png|thumb|left|LSC]] | | [[Image:ShowMessage.png|thumb|left|LSC]] | ||
|- | |- | ||
− | | Square ShowMessageReset | + | | Square ShowMessageReset |
− | | When the user click any square Sq1, if the square IsSource is "empty" and the board next turn not equals the Sq1 piecetype then the square showmessage and the Issource is set to "empty". | + | | When the user click any square Sq1, if the square IsSource is "empty" and the board next turn not equals the Sq1 piecetype then the square showmessage and the Issource is set to "empty". |
| [[Image:ShowmessageReset.jpg|thumb|left|LSC]] | | [[Image:ShowmessageReset.jpg|thumb|left|LSC]] | ||
|- | |- | ||
− | | Square ResetPossiblePosition | + | | Square ResetPossiblePosition |
− | | When the user click any square Sq1, the square Sq1 setPossiblePosition and the user click any other square Sq2 then the Sq2 resetPossiblePosition of the Sq1. | + | | When the user click any square Sq1, the square Sq1 setPossiblePosition and the user click any other square Sq2 then the Sq2 resetPossiblePosition of the Sq1. |
| [[Image:ResetPossiblePosition.png|thumb|left|LSC]] | | [[Image:ResetPossiblePosition.png|thumb|left|LSC]] | ||
|} | |} | ||
− | <br> | + | <br> |
== Graph and Connections<br> == | == Graph and Connections<br> == | ||
Line 64: | Line 64: | ||
===== Example of a not working LSC ===== | ===== Example of a not working LSC ===== | ||
− | <br> | + | <br> |
{| width="100%" border="1" align="left" cellpadding="1" cellspacing="1" | {| width="100%" border="1" align="left" cellpadding="1" cellspacing="1" | ||
|- | |- | ||
− | ! scope="col" width="15%" | Name | + | ! scope="col" width="15%" | Name |
− | ! scope="col" width="70%" | Explanation | + | ! scope="col" width="70%" | Explanation |
! scope="col" width="15%" | LSC | ! scope="col" width="15%" | LSC | ||
|- | |- | ||
− | | Square ResetHighlight | + | | Square ResetHighlight |
− | | when the square sq2 is highlighed and the user click that square Sq2 then the square reset the highlight. Since the Sq2 is dynamic and there are more highlighted squares it leads to the universal binding. The | + | | when the square sq2 is highlighed and the user click that square Sq2 then the square reset the highlight. Since the Sq2 is dynamic and there are more highlighted squares it leads to the universal binding. The |
| [[Image:ResetHighlight.png|thumb|left|LSC]] | | [[Image:ResetHighlight.png|thumb|left|LSC]] | ||
|} | |} | ||
− | <br> | + | <br> |
== Example-2 LSCs with Natural Language == | == Example-2 LSCs with Natural Language == | ||
− | <br> | + | <br> |
{| width="100%" border="1" align="left" cellpadding="1" cellspacing="1" | {| width="100%" border="1" align="left" cellpadding="1" cellspacing="1" | ||
|- | |- | ||
− | ! scope="col" width="15%" | Name | + | ! scope="col" width="15%" | Name |
− | ! scope="col" width="70%" | Natural Language Text | + | ! scope="col" width="70%" | Natural Language Text |
! scope="col" width="15%" | LSC | ! scope="col" width="15%" | LSC | ||
|- | |- | ||
− | | ChessNL SelectSource | + | | ChessNL SelectSource |
− | | when the user clicks any Square, if the board sourcetargetValue is "0" and the Square type is not "vacent" then the Square selectSource and the board sourcetargetValue changes to "1". | + | | when the user clicks any Square, if the board sourcetargetValue is "0" and the Square type is not "vacent" then the Square selectSource and the board sourcetargetValue changes to "1". |
− | | | + | | |
− | [[Image:SelectSource.png|thumb|left|LSC]] | + | [[Image:SelectSource.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL SelectTarget | + | | ChessNL SelectTarget |
− | | when the user clicks any Square, if the board sourcetargetValue is "1" then the Square selectTarget and the board sourcetargetValue changes to "0". | + | | when the user clicks any Square, if the board sourcetargetValue is "1" then the Square selectTarget and the board sourcetargetValue changes to "0". |
− | | | + | | |
− | [[Image:SelectTarget.png|thumb|left|LSC]] | + | [[Image:SelectTarget.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL CheckPossibility | + | | ChessNL CheckPossibility |
− | | when any Square selectTarget then the Square checkPossibility. | + | | when any Square selectTarget then the Square checkPossibility. |
− | | | + | | |
− | [[Image:CheckPossibility.png|thumb|left|LSC]] | + | [[Image:CheckPossibility.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL MovePiece | + | | ChessNL MovePiece |
− | | when any Square checkPossibility, if the Square possibility is "true" then the Square MovePiece. | + | | when any Square checkPossibility, if the Square possibility is "true" then the Square MovePiece. |
− | | | + | | |
− | [[Image:MoveSource.png|thumb|left|LSC]] | + | [[Image:MoveSource.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL TurnChange | + | | ChessNL TurnChange |
− | | when any Square MovePiece, if the board state is "black" then the board state changes to "white" otherwise if the board state is "white" then the board state changes to "black" . | + | | when any Square MovePiece, if the board state is "black" then the board state changes to "white" otherwise if the board state is "white" then the board state changes to "black" . |
− | | | + | | |
− | [[Image:TurnChange.png|thumb|left|LSC]] | + | [[Image:TurnChange.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL WrongTurn | + | | ChessNL WrongTurn |
− | | when any Square selectSource, if the Square type is "black" and the board state is "white" then the Square showMessage. | + | | when any Square selectSource, if the Square type is "black" and the board state is "white" then the Square showMessage. |
− | | | + | | |
− | [[Image:WrongTurn1.png|thumb|left|LSC]] | + | [[Image:WrongTurn1.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL WrongTurn2 | + | | ChessNL WrongTurn2 |
− | | when any Square selectSource, if the Square type is "white" and the board state is "black" then the Square showMessage. | + | | when any Square selectSource, if the Square type is "white" and the board state is "black" then the Square showMessage. |
− | | | + | | |
− | [[Image:WrongTurn2.png|thumb|left|LSC]] | + | [[Image:WrongTurn2.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL ResetBoard | + | | ChessNL ResetBoard |
− | | when any Square showMessage then the board sourcetargetValue changes to "0". | + | | when any Square showMessage then the board sourcetargetValue changes to "0". |
− | | | + | | |
− | [[Image:ResetBoard.png|thumb|left|LSC]] | + | [[Image:ResetBoard.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL PawnPossiblePosition | + | | ChessNL PawnPossiblePosition |
− | | when any Square selectSource, if the Square piecename is "pawn" then the Square setPossiblePawnSquares. | + | | when any Square selectSource, if the Square piecename is "pawn" then the Square setPossiblePawnSquares. |
− | | | + | | |
− | [[Image:PawnPossible.png|thumb|left|LSC]] | + | [[Image:PawnPossible.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL RookPossiblePosition | + | | ChessNL RookPossiblePosition |
− | | when any Square selectSource, if the Square piecename is "rook" then the Square setPossibleRookSquares . | + | | when any Square selectSource, if the Square piecename is "rook" then the Square setPossibleRookSquares . |
− | | | + | | |
− | [[Image:RookPossible.png|thumb|left|LSC]] | + | [[Image:RookPossible.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL KnightPossiblePosition | + | | ChessNL KnightPossiblePosition |
− | | when any Square selectSource, if the Square piecename is "knight" then the Square setPossibleKnightSquares. | + | | when any Square selectSource, if the Square piecename is "knight" then the Square setPossibleKnightSquares. |
− | | | + | | |
− | [[Image:KnightPossible.png|thumb|left|LSC]] | + | [[Image:KnightPossible.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL BishopPossiblePosition | + | | ChessNL BishopPossiblePosition |
− | | when any Square selectSource, if the Square piecename is "bishop" then the Square setPossibleBishopSquares. | + | | when any Square selectSource, if the Square piecename is "bishop" then the Square setPossibleBishopSquares. |
− | | | + | | |
− | [[Image:BishopPossible.png|thumb|left|LSC]] | + | [[Image:BishopPossible.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL QueenPossiblePosition | + | | ChessNL QueenPossiblePosition |
− | | when any Square selectSource, if the Square piecename is "queen" then the Square setPossibleQueenSquares . | + | | when any Square selectSource, if the Square piecename is "queen" then the Square setPossibleQueenSquares . |
− | | | + | | |
− | [[Image:QueenPossible.png|thumb|left|LSC]] | + | [[Image:QueenPossible.png|thumb|left|LSC]] |
|- | |- | ||
− | | ChessNL KingPossiblePosition | + | | ChessNL KingPossiblePosition |
− | | when any Square selectSource, if the Square piecename is "king" then the Square setPossibleKingSquares . | + | | when any Square selectSource, if the Square piecename is "king" then the Square setPossibleKingSquares . |
− | | | + | | |
− | [[Image:KingPossible.png|thumb|left|LSC]] | + | [[Image:KingPossible.png|thumb|left|LSC]] |
|} | |} | ||
− | <br> <br> | + | <br> <br> |
== Graph and Connections<br> == | == Graph and Connections<br> == |
Revision as of 08:41, 3 March 2013
This is a protected page for the Chess Game Example.
Contents
Chess Game Example
The ChessGameExample demonstrate original chess with a two-player strategy played on a chessboard. The original chess game has lots of rules and regulations most of them are implemented in this example.The game accepts moves through the mouse click on the piece,which is the source, and another click on the target. A source selection highlights valid user moves for target selection. The game can be constructed in different ways, in which two of them are described below.
Game Board
Example 1 - LSC for the game
Name | Description | LSC |
---|---|---|
Square PieceClick | When the user click any square Sq1, and then click any square Sq2, if the board next turn is equals to the Sq1 piece type then the square Sq1 check_Move square Sq2. | |
Square MovePiece | When the square Sq1 check_Move square Sq2, canmove is assigned whether the movement of piece from square Sq1 to Sq2 is possible, if the piece canmove and Sq1 piecetype is not equals to Sq2 piecetype then the square Sq1 move_Piece to square Sq2. | |
Square RemovePiece | When the square Sq1 move_Piece to square Sq2, then the square Sq2 emptyPiece the square Sq2. | |
Square NextMove | When the square Sq1 move_Piece to square Sq2, if the board next turn is "white" the board next turn changes to "black" otherwise if the board next turn is "black" the board next turn changes to "white". | |
Square SetSource | When the user click any square Sq1, if the Issource is "empty" then the square Sq1's possible positions are set and the IsSource changes to "set". | |
Square ShowMessage | When the user click any square Sq1, if the square IsSource is "empty" and the board next turn not equals the Sq1 piecetype then the square showmessage and the Issource is set to "empty". | |
Square ShowMessageReset | When the user click any square Sq1, if the square IsSource is "empty" and the board next turn not equals the Sq1 piecetype then the square showmessage and the Issource is set to "empty". | |
Square ResetPossiblePosition | When the user click any square Sq1, the square Sq1 setPossiblePosition and the user click any other square Sq2 then the Sq2 resetPossiblePosition of the Sq1. |
Graph and Connections
Example of a not working LSC
Name | Explanation | LSC |
---|---|---|
Square ResetHighlight | when the square sq2 is highlighed and the user click that square Sq2 then the square reset the highlight. Since the Sq2 is dynamic and there are more highlighted squares it leads to the universal binding. The |
Example-2 LSCs with Natural Language
Name | Natural Language Text | LSC |
---|---|---|
ChessNL SelectSource | when the user clicks any Square, if the board sourcetargetValue is "0" and the Square type is not "vacent" then the Square selectSource and the board sourcetargetValue changes to "1". | |
ChessNL SelectTarget | when the user clicks any Square, if the board sourcetargetValue is "1" then the Square selectTarget and the board sourcetargetValue changes to "0". | |
ChessNL CheckPossibility | when any Square selectTarget then the Square checkPossibility. | |
ChessNL MovePiece | when any Square checkPossibility, if the Square possibility is "true" then the Square MovePiece. | |
ChessNL TurnChange | when any Square MovePiece, if the board state is "black" then the board state changes to "white" otherwise if the board state is "white" then the board state changes to "black" . | |
ChessNL WrongTurn | when any Square selectSource, if the Square type is "black" and the board state is "white" then the Square showMessage. | |
ChessNL WrongTurn2 | when any Square selectSource, if the Square type is "white" and the board state is "black" then the Square showMessage. | |
ChessNL ResetBoard | when any Square showMessage then the board sourcetargetValue changes to "0". | |
ChessNL PawnPossiblePosition | when any Square selectSource, if the Square piecename is "pawn" then the Square setPossiblePawnSquares. | |
ChessNL RookPossiblePosition | when any Square selectSource, if the Square piecename is "rook" then the Square setPossibleRookSquares . | |
ChessNL KnightPossiblePosition | when any Square selectSource, if the Square piecename is "knight" then the Square setPossibleKnightSquares. | |
ChessNL BishopPossiblePosition | when any Square selectSource, if the Square piecename is "bishop" then the Square setPossibleBishopSquares. | |
ChessNL QueenPossiblePosition | when any Square selectSource, if the Square piecename is "queen" then the Square setPossibleQueenSquares . | |
ChessNL KingPossiblePosition | when any Square selectSource, if the Square piecename is "king" then the Square setPossibleKingSquares . |