-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java win condition check #21
Conversation
@@ -108,8 +108,7 @@ public void communicate() { | |||
String[] split = answer.split(" "); | |||
switch (split[0]) { | |||
case "endTurn": | |||
break loop; | |||
|
|||
throw new RuntimeException("out of units"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha befejezi a kört, akkor elfogytak a unitjai? Ezért biztos, hogy exceptiont kel dobni? Nem lehetne return?
@@ -83,7 +83,7 @@ public void registerUnit() { | |||
} | |||
|
|||
|
|||
public void communicate() { | |||
public void communicate() throws RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeException
-t nem kell kiírni, meg amúgy is lehetne helyette valami egyértelműbb.
@@ -115,6 +115,13 @@ public Team team(String name) { | |||
return teams.get(name); | |||
} | |||
|
|||
// this method should call the final thread closer as of #15 | |||
public void winEvent(String winnerTeam) { | |||
System.out.println(winnerTeam + " team won!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A játék eredményéről nem kéne értesíteni a pythonos cuccokat is?
public void winEvent(String winnerTeam) { | ||
System.out.println(winnerTeam + " team won!"); | ||
|
||
System.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha vége a játéknak, akkor bezárjuk a programot? Nem lehet új játékot kezdeni?
try { | ||
c.communicate(); | ||
} catch (RuntimeException e) { | ||
mm.winEvent(c.getTeam().getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
az nyer, aki elrontotta a kommunikációt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha több mint kettő csapat van, akkor most mindenki más nyerni fog. Kerüljön bele a specifikációba, hogy csak kettő csapat lehet.
@@ -19,6 +19,7 @@ public class MainModel { | |||
private Map<Position, Field> fields; | |||
private ArrayList<ControlPoint> controlPoints; | |||
private List<MainModelListener> listeners; | |||
private mainModelCommunicatorListener mmcl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nem lehetne érthetőbb változóneveket használni?
throw new RuntimeException(e); | ||
} | ||
System.out.println("here"); | ||
System.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit helyett egy resetet kéne csinálni és újrakezdeni a szimulációt
@@ -0,0 +1,6 @@ | |||
package temalab.common; | |||
|
|||
public interface mainModelCommunicatorListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nagy betűvel kéne kezdődnie
@@ -67,4 +68,15 @@ public void change() { | |||
} | |||
System.out.println("paused = " + pause); | |||
} | |||
|
|||
@Override | |||
public void teamLost(String name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
itt nem lehetne string helyett egy a csapat objektumot átadni?
test/python/test1.py
Outdated
@@ -32,6 +32,7 @@ def communicate(units): | |||
def endPhase(units): | |||
result = input() | |||
logger.debug_print(result) | |||
sys.exit(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end után nem lehet új játékot kezdeni
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
igazából jó, de ezeket az apróságokat javítsad még ki
@@ -75,6 +77,11 @@ public void onShoot(Position p) { | |||
|
|||
@Override | |||
public void unitDied() { | |||
gv.unitDestoryed(u); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha a unitDestroyed ezzel használatlan lett, akkor legyen kitörölve
test/python/test1.py
Outdated
@@ -31,7 +31,8 @@ def communicate(units): | |||
|
|||
def endPhase(units): | |||
result = input() | |||
logger.debug_print(result) | |||
logger.debug_print("ASDF:", result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asdf helyett lehetne értelmesebb debug üzenet
@@ -168,4 +175,12 @@ public int width() { | |||
public List<Team> getTeams() { | |||
return new ArrayList<Team>(teams.values()); | |||
} | |||
|
|||
|
|||
// this method should call the final thread closer as of #15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ez még releváns? Ha nem, töröld, ha igen, implementáld.
new Position(Integer.parseInt(split[2]), Integer.parseInt(split[3]))); | ||
} | ||
loop: | ||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ez a loop direkt lett egyel bentebb indentálva?
@@ -75,6 +77,11 @@ public void onShoot(Position p) { | |||
|
|||
@Override | |||
public void unitDied() { | |||
gv.unitDestoryed(u); | |||
visible = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Itt nem lesz probléma ha a mezőre akar lépni egy másik unit?
pretty basic, but if any of the teams has zero units, it closes the program close #3