Whenever the player receives a move command with his identifier it means that he tried to move a piece
by using his console.
i.e. he dragged a piece and the coordinates that he referenced were recorded.

Whenever this occurs then we have to check every detail of the movement to verify that all the rules have
been preserved. This is the most important part of the game rules, the gateway one would say, as if the move is considered legal
the move is processed and sent to all participants. This creates a situation that can not be inverted as all the structures
and consoles will have changed to accomodate this move.

The Dat Flow Diagram of this case is displayed below.

Circles represent terminal conditions. When we have text inside inverted commas (") then it represents a string being outputted on the user's
console. When there is no commas then commands are represented. When there is a diamond then we have a conditional.

In the diagram we have integrated the turn based rule and the Stratego game rules.

NOTES ON DIAGRAM

1: the check_piece_clicked function checks the two coordinates of the move function (x1,y1 and x2,y2) to see if tehy belong to the appropriate player

2: the "process move" terminal symbol handles the checks for legality of move as indicated by the rules of the game and the completion of the move

Actions performed are:
  • check legality of move
  • if legal move x1,y1 to x2,y2 and then clear x1,y1. Furthermore update battlefield array and send appropriate move command to network and set turn to 0.

    3: the "process attack" involves the decision of who will win the attack and the process of the movement after the attack.

    Outcomes of attack are:
  • piece at x1,y1 winner. Move x1,y1 to x2,y2 and then clear x1,y1
  • piece at x2,y2 winner. Empty piece x1,y1
  • draw. Empty both pieces
  • piece x2,y2 is a flag so declare winner and end game
    After the attack has been resolved, the graphics and data structures are updated, and the appropriate move command is sent to the network.
    Finally the turn variable should be set to 0, to prevent the player from playing twice in a row.


    Please email me if you have any questions.

    Back to the battle page
    Back to core module home page
    Back to core design page


    Copyright © 2002 Spyros Lambrinidis
    Last Updated 16/03/02