KillianMills

SnakesLadders.java

Oct 1st, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. class Board{
  4.         private Box[][] board= new Box[10][10];
  5.        
  6.         void add(Box b) {
  7.                 board[b.getI()][b.getJ()]=b;
  8.         }
  9. }
  10.  
  11. class Box{
  12.         private int i,j;
  13.        
  14.         Box(int i, int j)
  15.         {
  16.                 this.i=i;
  17.                 this.j=j;
  18.         }
  19.         int getI()
  20.         {
  21.                 return i;
  22.         }
  23.         int getJ()
  24.         {
  25.                 return j;
  26.         }
  27. }
  28.  
  29. class Special extends Box{
  30.         private boolean isHead;
  31.         private boolean isSnake;
  32.         private int pairId;
  33.         private boolean specialObject;
  34.        
  35.        
  36.         Special(int i0, int j0, boolean isHead0, int pairId0, boolean isSnake0,boolean specialObject0){
  37.                         super(i0,j0);
  38.                         isHead0=isHead;
  39.                         pairId0=pairId;
  40.                         isSnake0=isSnake;
  41.                         specialObject0=specialObject;
  42.         }
  43. }
  44.  
  45. class Die{
  46.         private int dieValue;
  47.        
  48.         int roll(){
  49.                 Random rn = new Random();
  50.                 dieValue=rn.nextInt(6);
  51.                 return dieValue;
  52.         }
  53. }
  54. class PlayerPiece{
  55.         private int location;  
  56. }
  57.  
  58. class SnakeLadder{
  59.  
  60.         static void fillBoard(Board b){
  61.                 for (int i=0;i<10;i++){
  62.                         for(int j=0;j<10;j++){
  63.                                 b.add(new Box(i,j));
  64.                         }
  65.                 }
  66.         }
  67.        
  68.         public static void main (String [] args){
  69.                 System.out.println("Main");
  70.                 Board SLboard = new Board();
  71.                 fillBoard(SLboard);
  72.                 PlayerPiece Player1 = new PlayerPiece();
  73.                 PlayerPiece Player2 = new PlayerPiece();
  74.         }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment