Skip to content
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

Merged
merged 6 commits into from
May 21, 2024
Merged

Java win condition check #21

merged 6 commits into from
May 21, 2024

Conversation

koczoa
Copy link
Contributor

@koczoa koczoa commented May 12, 2024

pretty basic, but if any of the teams has zero units, it closes the program close #3

@koczoa koczoa self-assigned this May 12, 2024
@@ -108,8 +108,7 @@ public void communicate() {
String[] split = answer.split(" ");
switch (split[0]) {
case "endTurn":
break loop;

throw new RuntimeException("out of units");
Copy link
Contributor

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 {
Copy link
Contributor

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!");
Copy link
Contributor

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);
Copy link
Contributor

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());
Copy link
Contributor

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?

@koczoa koczoa marked this pull request as draft May 21, 2024 13:46
@koczoa koczoa requested a review from daniel-szarkowicz May 21, 2024 13:46
@daniel-szarkowicz daniel-szarkowicz marked this pull request as ready for review May 21, 2024 13:49
Copy link
Contributor

@daniel-szarkowicz daniel-szarkowicz left a 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;
Copy link
Contributor

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);
Copy link
Contributor

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 {
Copy link
Contributor

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) {
Copy link
Contributor

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?

@@ -32,6 +32,7 @@ def communicate(units):
def endPhase(units):
result = input()
logger.debug_print(result)
sys.exit(0)
Copy link
Contributor

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

@koczoa koczoa linked an issue May 21, 2024 that may be closed by this pull request
Copy link
Contributor

@daniel-szarkowicz daniel-szarkowicz left a 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);
Copy link
Contributor

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

@@ -31,7 +31,8 @@ def communicate(units):

def endPhase(units):
result = input()
logger.debug_print(result)
logger.debug_print("ASDF:", result)
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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;
Copy link
Contributor

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?

@koczoa koczoa merged commit d44d17d into master May 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

java reset died units java win condition check
3 participants