Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public World(int size, double foodProb, double grazerProb) {
- char[][] grid;
- grid = new char[size][size];
- foodProb = Math.random();
- grazerProb = Math.random();
- for (int row = 0; row < grid.length; row++) {
- for (int col = 0; col < grid.length; col++) {
- if(grid[row][col] == foodProb) {
- System.out.print(".");
- }
- if(grid[row][col] == grazerProb) {
- System.out.print("@");
- } else {
- System.out.print(" ");
- }
- }
- }
- System.out.println(grid);
- }
Add Comment
Please, Sign In to add comment