Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int tab[][] = new int[10][10];
- int nr, startX, startY, koniecX, koniecY;
- for (int i = 0; i < tab.length; i++) { //uzepelnienie tablicy 1 i 2 losowo zerami i jedynkami
- for (int j = 0; j < tab[i].length; j++) {
- nr = (int) Math.round(Math.random());
- tab[i][j] = nr;
- }
- }
- startX = (int) Math.floor(Math.random() * 10);
- startY = (int) Math.floor(Math.random() * 10);
- //tab[startX][startY] = "S";
- koniecX = (int) Math.floor(Math.random() * 10);
- koniecY = (int) Math.floor(Math.random() * 10);
- //tab[koniecX][koniecY] = "K";
- System.out.println("Wspolrzedne start: " + startX + "," + startY);
- System.out.println("Wspolrzedne koniec: " + koniecX + "," + koniecY);
- for (int i = 0; i < tab.length; i++) {
- for (int j = 0; j < tab[i].length; j++) {
- System.out.print(tab[i][j] + " ");
- }
- System.out.println();
- }
- // Find shortest path from source (0, 0) to
- // destination (7, 5)
- findPath(tab, startX, startY, koniecX, koniecY);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement