try fix algo

This commit is contained in:
delta1805 2017-09-24 22:10:40 +02:00
parent 391e9ac5be
commit 47d57b8a88
2 changed files with 12 additions and 1 deletions

View File

@ -22,7 +22,7 @@ public class Spiel {
this.heimteam = heim; this.heimteam = heim;
this.auswärtsteam = aus; this.auswärtsteam = aus;
this.schiri = s; this.schiri = s;
ballBesitz = ((int) Math.random()) == 0 ? true : false; ballBesitz = Math.random() < 0.5 ? true : false;
spielzeit = 0; spielzeit = 0;
heimteam.setPositions(true); heimteam.setPositions(true);
auswärtsteam.setPositions(false); auswärtsteam.setPositions(false);
@ -87,6 +87,7 @@ public class Spiel {
System.out.println(s.getname() + " gab Ball an " + g.getname()); System.out.println(s.getname() + " gab Ball an " + g.getname());
g.takeBall(s); g.takeBall(s);
s.motivation -= 20; s.motivation -= 20;
ballWechsel();
} }
if (rng < 90) { if (rng < 90) {
@ -107,6 +108,7 @@ public class Spiel {
// Pass wurde unterbrochen // Pass wurde unterbrochen
temp.takeBall(s); temp.takeBall(s);
succes = true; succes = true;
ballWechsel();
break; break;
} }
} }
@ -131,6 +133,7 @@ public class Spiel {
// Pass wurde unterbrochen // Pass wurde unterbrochen
temp.takeBall(s); temp.takeBall(s);
succes = true; succes = true;
ballWechsel();
break; break;
} }
} }
@ -165,6 +168,7 @@ public class Spiel {
// Pass wurde unterbrochen // Pass wurde unterbrochen
temp.takeBall(s); temp.takeBall(s);
succes = true; succes = true;
ballWechsel();
break; break;
} }
} }
@ -180,7 +184,13 @@ public class Spiel {
} }
} }
public boolean torMoeglich(){
return false;
}
public void ballWechsel(){
ballBesitz = !ballBesitz;
}
public String getSpielzeit() { public String getSpielzeit() {
String r = ""; String r = "";

View File

@ -74,6 +74,7 @@ public class Team {
} }
public boolean isInTeam(Person p){ public boolean isInTeam(Person p){
for(Person pp:spieler){ for(Person pp:spieler){
if(p.equals(pp)) return true; if(p.equals(pp)) return true;