Difference between revisions of "Chess Game Example"
Line 125: | Line 125: | ||
<br> <br> | <br> <br> | ||
− | |||
Line 207: | Line 206: | ||
<br><br> <br> | <br><br> <br> | ||
+ | == Download the ChessGame Example == | ||
+ | Below are downloads of the ChessGame final application, as well as of the LSC project that can be opened and modified in PlayGo.<br> | ||
+ | ===Wristwatch final application (runnable jar)=== | ||
+ | [[Media:ChessGamehExampleSwingGUI.zip|Runnable Chess Game with Swing GUI]] <br> | ||
+ | |||
== Graph and Connections == | == Graph and Connections == |
Revision as of 11:15, 28 April 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 [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.
Contents
Game Board
Example 1 -ChessProject- LSCs created with NL-Play-In (chesswithNL.umlseq)
The LSCs in this section were created with the NL-Play-In. The natural language text was parsed automatically to create the LSC.
Name | Natural Language Text | LSC |
---|---|---|
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". | |
SelectTarget | when the user clicks any Square, if the board sourcetargetValue is "1" then the Square selectTarget and the board sourcetargetValue changes to "0". | |
CheckPossibility | when any Square selectTarget then the Square checkPossibility. | |
MovePiece | when any Square checkPossibility, if the Square possibility is "true" then the Square MovePiece. | |
ChangeTurn | 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" . | |
WrongTurn | when any Square selectSource, if the Square type is "black" and the board state is "white" then the Square showMessage. | |
WrongTurn2 | when any Square selectSource, if the Square type is "white" and the board state is "black" then the Square showMessage. | |
ResetBoard | when any Square showMessage then the board sourcetargetValue changes to "0". | |
SetPossiblePosition | when any Square selectSource then the Square setPossibleSquares . | |
checkmate | when any Square MovePiece then the Square check_CheckMate | |
BlkKingPosition.png | when any square MovePiece, if the square piecename is "blkking" then the board BlkkingPosition changes to the square position | |
WteKingPosition | when any square MovePiece, if the square piecename is "wteking" then the board WtekingPosition changes to the square position | |
Newgame | when the user click the newgame then the newgame loadnewgame and the board reset | |
ShowScoreblack | when the board state change then the BlkScore show the board blackPoint | |
ShowScorewhite | when the board state change then the WteScore show the board whitePoint | |
ShowNextTurn | when the board state change then the NextTurndisplay show the board state | |
ResetPossiblePosition | when any Square selectTarget then the Square reset |
Example 2 -ChessGame- LSC for the game(square.umlseq)
The following LSCs where created with the use of the editor. Our intention was to create a specification with more than one symbolic lifeline in the LSCs and possibly more than one monitored event at the chart start.
Name | Description | LSC |
---|---|---|
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 and if the Sq1 is a source then the square Sq1 check_Move square Sq2. | |
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. | |
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". | |
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". | |
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". | |
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". | |
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. | |
CheckMate | When the any square Sq2 emptypiece any square Sq1, then isCheck is assigned whether there is any checkmate, if the checkmate is true then the square show the checkmate otherwise square removecheckmate. | |
kingposition | When the any square Sq2 emptypiece any square Sq1, if the Sq2 piecname is wteking then the Sq1 removecheckMate and the board wtekingposition is set to the Sq2 position else if the Sq2 piecname is blkking then the Sq1 removecheckMate and the board blkkingposition is set to the Sq2 position . | |
showturn | When the board set the Next_turn to any then the NextTurn show the board Next turn. | |
BlackPiecepoint | When the any square Sq2 emptypiece any square Sq1, if the board Next_turn is white then the blk_score show the black point. | |
WhitePiecepoint | When the any square Sq2 emptypiece any square Sq1, if the board Next_turn is black then the wte_score show the white point. | |
GameOver | When the any square Sq1 movePiece to any square Sq2, if the board black point is 0 then the white won the game otherwise if the board white point is 0 then the black won the game | |
Loadgame | when the user click NewGame then the NewGame load new game |
Download the ChessGame Example
Below are downloads of the ChessGame final application, as well as of the LSC project that can be opened and modified in PlayGo.
Wristwatch final application (runnable jar)
Runnable Chess Game with Swing GUI
Graph and Connections
Example1-ChessProject
Dependency graph for Example 1. This graph shows clusters (communities). And MovePiece is selected here and the connected LSCs are colored (blue or pink). Green edges are unified messages between LSCs.
See [| SIV-Plugin] for details.
Example2-ChessGame
Dependency graph for Example 2. This graph also shows clusters (communities). And MovePiece is selected here and the connected LSCs are colored (blue or pink). Green edges are unified messages between LSCs.
Note: messages were unified here regardless of the parameters, since parameters are symbolic, e.g., MovePiece(String piecename).
see[| SIV-Plugin] for details
General observations: Both seem plausible, although they are a bit different.
SystemModel
Example1-ChessProject
Example2-ChessGame
Example 3 - a non working LSC
In this example, we demonstrate an LSC created, that seems to work, but will not work due to an unbound lifeline.
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 Sq2 is dynamic and there are more highlighted squares it leads to the universal binding.