gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93c80cd)
raw | patch | inline | side by side (parent: 93c80cd)
author | Ivan Pribela <ivanpribela@gmail.com> | |
Fri, 8 Dec 2017 19:52:45 +0000 (20:52 +0100) | ||
committer | Ivan Pribela <ivanpribela@gmail.com> | |
Fri, 8 Dec 2017 19:52:45 +0000 (20:52 +0100) |
diff --git a/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Lavirint.java b/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Lavirint.java
index 5b84e5adfddf7d0207d7c8a90d54dd6bb8ebc2ee..7f18f3f4eebcc6d52fde1b61cffcb50c51ed54ed 100644 (file)
private Put optResenje;\r
\r
// Ucitava mapu iz datog fajla i stampa je na ekran\r
- Lavirint(String imeFajla) {\r
+ public Lavirint(String imeFajla) {\r
m = new Mapa(imeFajla);\r
m.stampaj();\r
}\r
diff --git a/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/LavirintProgram.java b/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/LavirintProgram.java
index e622674ac21246cc04a13aab1c26240f1b0e7f2d..328f62ca2247c8e0b096ad1eeaf3021dd574e9cd 100644 (file)
System.out.println("Unesite izbor 1-4:");\r
int op = Svetovid.in.readInt();\r
\r
- Lavirint l = new Lavirint(fajl);\r
- Put r;\r
+ Lavirint lavirint = new Lavirint(fajl);\r
+ Put put;\r
\r
- if (l != null) {\r
+ if (lavirint != null) {\r
\r
switch (op) {\r
case 1:\r
- if (l.postojiPut(0, 0)) {\r
+ if (lavirint.postojiPut(0, 0)) {\r
System.out.println("Postoji put");\r
} else {\r
System.out.println("Ne postoji put");\r
}\r
break;\r
case 2:\r
- l.nadjiPut(0, 0);\r
+ lavirint.nadjiPut(0, 0);\r
break;\r
case 3:\r
- r = l.najkraciPut(0, 0);\r
- if (r != null) {\r
- r.stampaj();\r
+ put = lavirint.najkraciPut(0, 0);\r
+ if (put != null) {\r
+ put.stampaj();\r
} else {\r
- System.out.println("Nema resenja");\r
+ System.out.println("Ne postoji put");\r
}\r
break;\r
case 4:\r
- r = l.najvrednijiPut(0, 0);\r
- if (r != null) {\r
- r.stampaj();\r
- System.out.println("Vrednost puta: " + r.getVrednost());\r
+ put = lavirint.najvrednijiPut(0, 0);\r
+ if (put != null) {\r
+ put.stampaj();\r
} else {\r
- System.out.println("Nema resenja");\r
+ System.out.println("Ne postoji put");\r
}\r
break;\r
default:\r
diff --git a/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Mapa.java b/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Mapa.java
index a39c662ac284ec6068414181c93b7a7437bf3df7..091f37d8f8144fd353e663b0170d9ecf75ebcf97 100644 (file)
\r
public void stampaj() {\r
if (visina != 0 && sirina != 0) {\r
- System.out.println(visina + " " + sirina);\r
+ System.out.println();\r
+ System.out.println("Mapa sirine " + sirina + " i visine " + visina);\r
for (int j = 0; j < visina; j++) {\r
for (int i = 0; i < sirina; i++) {\r
- System.out.print(mat[i][j] + "\t");\r
+ System.out.printf("%5d", mat[i][j]);\r
}\r
System.out.println();\r
}\r
diff --git a/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Put.java b/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Put.java
index e9428836ce434675ed87f755a031992dece8f320..9ecf9a1e655c7be5e1b30773e1ad8c344f1925f0 100644 (file)
\r
// Stampa put\r
public void stampaj() {\r
- System.out.println(getLength());\r
+ System.out.println();\r
+ System.out.println("Put duzine " + getLength() + " i vrednosti " + getVrednost());\r
for (int i = 0; i < getLength(); i++) {\r
System.out.println(polja.get(i));\r
}\r