Difference between revisions of "Chess Game Example"

From WeizmannWiki
Jump to: navigation, search
Line 1: Line 1:
This is a protected page for the Chess Game Example.
+
This is a protected page for the Chess Game Example.  
  
The '''chess game example''' demonstrates the creation of a chess game for two-players. The chess game has many rules and that are implemented in this example, see [[http://en.wikipedia.org/wiki/Chess]]. The games interface is throught mouse clicks on the peices and the chess board's squares. A click on a square highlights valid user moves according to the rules of chess and the selected piece. The game is implemented with LSCs that can created in different ways, in this example, we present requirements created in two ways: one using the natural language interface to LSCs (NL-Play-In) and the other using the editor. We also review the differences between the approaches.
+
The '''chess game example''' demonstrates the creation of a chess game for two-players. The chess game has many rules and that are implemented in this example, see [[http://en.wikipedia.org/wiki/Chess]]. The games interface is throught mouse clicks on the peices and the chess board's squares. A click on a square highlights valid user moves according to the rules of chess and the selected piece. The game is implemented with LSCs that can created in different ways, in this example, we present requirements created in two ways: one using the natural language interface to LSCs (NL-Play-In) and the other using the editor. We also review the differences between the approaches.  
  
 
== 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.&nbsp;
+
| 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.&nbsp;  
|
+
|  
[[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, &nbsp;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, &nbsp;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&nbsp;the square Sq1 move_Piece to square Sq2, &nbsp;then the square Sq2 emptyPiece the square Sq2.
+
| When&nbsp;the square Sq1 move_Piece to square Sq2, &nbsp;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". &nbsp;
+
| 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". &nbsp;  
 
| [[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 60: Line 60:
 
===== 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. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Since the Sq2 is dynamic and there are more highlighted squares it leads to the universal binding. The&nbsp;
+
| when the square sq2 is highlighed and the user click that square Sq2 then the square reset the highlight. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Since the Sq2 is dynamic and there are more highlighted squares it leads to the universal binding. The&nbsp;  
 
| [[Image:ResetHighlight.png|thumb|left|LSC]]
 
| [[Image:ResetHighlight.png|thumb|left|LSC]]
 
|}
 
|}
  
<br> &nbsp; &nbsp;
+
<br> &nbsp; &nbsp;  
  
 
== Example-2 LSCs with Natural Language &nbsp; &nbsp;&nbsp;  ==
 
== Example-2 LSCs with Natural Language &nbsp; &nbsp;&nbsp;  ==
  
<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".&nbsp;
+
| 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".&nbsp;  
|
+
|  
[[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".&nbsp;
+
| when the user clicks any Square, if the board sourcetargetValue is "1" then the Square selectTarget and the board sourcetargetValue changes to "0".&nbsp;  
|
+
|  
[[Image:SelectTarget.png|thumb|left|LSC]]
+
[[Image:SelectTarget.png|thumb|left|LSC]]  
  
 
|-
 
|-
| ChessNL CheckPossibility
+
| ChessNL CheckPossibility  
| when any Square selectTarget then the Square checkPossibility. &nbsp;
+
| when any Square selectTarget then the Square checkPossibility. &nbsp;  
|
+
|  
[[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. &nbsp;
+
| when any Square checkPossibility, if the Square possibility is "true" then the Square MovePiece. &nbsp;  
|
+
|  
[[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" . &nbsp;
+
| 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" . &nbsp;  
|
+
|  
[[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. &nbsp;
+
| when any Square selectSource, if the Square type is "black" and the board state is "white" then the Square showMessage. &nbsp;  
|
+
|  
[[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. &nbsp;
+
| when any Square selectSource, if the Square type is "white" and the board state is "black" then the Square showMessage. &nbsp;  
|
+
|  
[[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". &nbsp;
+
| when any Square showMessage then the board sourcetargetValue changes to "0". &nbsp;  
|
+
|  
[[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. &nbsp;
+
| when any Square selectSource, if the Square piecename is "pawn" then the Square setPossiblePawnSquares. &nbsp;  
|
+
|  
[[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 . &nbsp;
+
| when any Square selectSource, if the Square piecename is "rook" then the Square setPossibleRookSquares . &nbsp;  
|
+
|  
[[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. &nbsp;
+
| when any Square selectSource, if the Square piecename is "knight" then the Square setPossibleKnightSquares. &nbsp;  
|
+
|  
[[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. &nbsp;
+
| when any Square selectSource, if the Square piecename is "bishop" then the Square setPossibleBishopSquares. &nbsp;  
|
+
|  
[[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 . &nbsp;
+
| when any Square selectSource, if the Square piecename is "queen" then the Square setPossibleQueenSquares . &nbsp;  
|
+
|  
[[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 . &nbsp;
+
| when any Square selectSource, if the Square piecename is "king" then the Square setPossibleKingSquares . &nbsp;  
|
+
|  
[[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:14, 4 March 2013

This is a protected page for the Chess Game Example.

The chess game example demonstrates the creation of a chess game for two-players. The chess game has many rules and that are implemented in this example, see [[1]]. The games interface is throught mouse clicks on the peices and the chess board's squares. A click on a square highlights valid user moves according to the rules of chess and the selected piece. The game is implemented with LSCs that can created in different ways, in this example, we present requirements created in two ways: one using the natural language interface to LSCs (NL-Play-In) and the other using the editor. We also review the differences between the approaches.

Game Board

ChessScreenShot.png


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. 
LSC
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.
LSC
Square RemovePiece When the square Sq1 move_Piece to square Sq2,  then the square Sq2 emptyPiece the square Sq2.
LSC
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".
LSC
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".  
LSC
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".
LSC
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".
LSC
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.
LSC


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 
LSC


   

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". 
LSC
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". 
LSC
ChessNL CheckPossibility when any Square selectTarget then the Square checkPossibility.  
LSC
ChessNL MovePiece when any Square checkPossibility, if the Square possibility is "true" then the Square MovePiece.  
LSC
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" .  
LSC
ChessNL WrongTurn when any Square selectSource, if the Square type is "black" and the board state is "white" then the Square showMessage.  
LSC
ChessNL WrongTurn2 when any Square selectSource, if the Square type is "white" and the board state is "black" then the Square showMessage.  
LSC
ChessNL ResetBoard when any Square showMessage then the board sourcetargetValue changes to "0".  
LSC
ChessNL PawnPossiblePosition when any Square selectSource, if the Square piecename is "pawn" then the Square setPossiblePawnSquares.  
LSC
ChessNL RookPossiblePosition when any Square selectSource, if the Square piecename is "rook" then the Square setPossibleRookSquares .  
LSC
ChessNL KnightPossiblePosition when any Square selectSource, if the Square piecename is "knight" then the Square setPossibleKnightSquares.  
LSC
ChessNL BishopPossiblePosition when any Square selectSource, if the Square piecename is "bishop" then the Square setPossibleBishopSquares.  
LSC
ChessNL QueenPossiblePosition when any Square selectSource, if the Square piecename is "queen" then the Square setPossibleQueenSquares .  
LSC
ChessNL KingPossiblePosition when any Square selectSource, if the Square piecename is "king" then the Square setPossibleKingSquares .  
LSC



Graph and Connections