Untitled
unknown
plain_text
10 months ago
1.3 kB
8
Indexable
Requirment :
functional requirement:
Board Class:
grid[]
player[]
methods: Startgame(), Movement(player_id, steps), check_wiining_player()
snake[{}];
ladder=[{}];
Player class:
player_id
player_position
methods: move(steps): no of steps player is moving , get_position(), check_if_snake_and_ladder(player_positon);
Die class:
faceValue : return the value within the 1-6
method :roll() range will be 1-6;
Snake class:
start_position: where the snake head is : where user will hit //
end_position : tail position of snake : where user will be moved
method : Move_player_to_end(player) // it will be moving to end position.
Ladder class:
start_position: where the ladder is start : where user will hit
end_position : top position of ladder : where user will be moved
method: moves_player_to_end(player) / it will move the player to end_position
public interface Movable{
void move(int steps); // default methods
}
public void moves_player_to_end(Player player){
if(player.getPosition()==this.start_position){
player.move() }
}}
grid()
startgame(){
Die.roll()
Board.Movement(player_id, steps)
{
Player.move(steps){curr_position+=val;}
check if it is snake || ladder || normal
}
Editor is loading...
Leave a Comment