Skip to content
Snippets Groups Projects
Select Git revision
  • 8395202955b052b86baad0f4f42b1720f7d967f5
  • main default protected
2 results

Program.java

Blame
  • Plateau.java 956 B
    package main;
    
    import java.util.Random;
    
    import items.Crown;
    
    public class Plateau {
    	private Region[][] plateau;
    	
    	public Plateau() {
    		Random random = new Random();
    		this.plateau = new Region[6][6];
    		for (int i = 0; i < plateau.length; i++) {
    			for (int j = 0; j < plateau[0].length; j++) {
    				plateau[i][j] = new Region();
    				plateau[i][j].setX(i);
    				plateau[i][j].setY(j);
    				plateau[i][j].fillRegion();
    			}
    		}
    		int rd1 = (int)random.nextInt(10)+10;
    		int rd2 = (int)random.nextInt(30);
    		this.getCase(rd1, rd2).setItem(new Crown(this.getCase(0, 0)));
    	}
    	public Case getCase(int x, int y) {
    		return plateau[x/5][y/5].region[x%5][y%5];
    	}
    	public Region getRegion(int x, int y ) {
    		return plateau[x/5][y/5];
    	}
    	public Region[][] getPlateau() {
    		return plateau;
    	}
    	public int getLength() {
    		return plateau.length * plateau[0][0].region.length;
    	}
    	public int getWidth() {
    		return plateau[0].length * plateau[0][0].region.length;
    	}
    }