EasyDevCpp / SoftwareChallenge

GNU General Public License v3.0
1 stars 0 forks source link

Part 2 spielt keine Karte aus (auf Karottenfeld) #10

Closed manuel3108 closed 7 years ago

manuel3108 commented 7 years ago

1 [Rot] Geht auf Karotte und scheint keine zu fressen. (Feld 33 und weiter auf Hasenfeld)

SC_Log:

Es muss eine Karte ausgespielt werden.
sc.shared.InvalidMoveException: Es muss eine Karte ausgespielt werden.
    at sc.plugin2018.Move.perform(Move.java:201) [na:na]
    at sc.plugin2018.Game.onRoundBasedAction(Game.java:78) [na:na]
    at sc.framework.plugins.RoundBasedGameInstance.onAction(RoundBasedGameInstance.java:72) [software_challenge-sdk.jar:na]
    at sc.server.gaming.GameRoom.onEvent(GameRoom.java:473) [softwarechallenge-server.jar:na]
    at sc.server.Lobby.onRequest(Lobby.java:124) [softwarechallenge-server.jar:na]
    at sc.server.network.Client.notifyOnPacket(Client.java:116) [softwarechallenge-server.jar:na]
    at sc.server.network.Client.onObject(Client.java:297) [softwarechallenge-server.jar:na]
    at sc.networking.clients.XStreamClient.receiveThread(XStreamClient.java:148) [software_challenge-sdk.jar:na]
    at sc.networking.clients.XStreamClient$1.run(XStreamClient.java:98) [software_challenge-sdk.jar:na]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_151]
17:19:24.345 [XStreamClient Receive Thread 503 Client] DEBUG sc.networking.clients.XStreamClient - Client sc.server.network.Client@6422952a: Sending sc.protocol.responses.RoomPacket@358779ec via sc.networking.TcpNetwork@dbdd0a9
DataDump:
<room roomId="f80863e4-787a-4166-91f7-976694db73ea">
  <data class="error" message="Ungueltiger Zug von &apos;Mensch&apos;.&#xa;Es muss eine Karte ausgespielt werden.">
    <originalRequest class="move">
      <advance order="0" distance="2"/>
    </originalRequest>
  </data>
</room>
17:19:24.346 [XStreamClient Receive Thread 503 Client] WARN  sc.server.network.Client - An error occured: 
sc.api.plugins.exceptions.GameLogicException: Ungueltiger Zug von 'Mensch'.
Es muss eine Karte ausgespielt werden.
    at sc.framework.plugins.RoundBasedGameInstance.catchInvalidMove(RoundBasedGameInstance.java:351) [software_challenge-sdk.jar:na]
    at sc.plugin2018.Game.onRoundBasedAction(Game.java:81) [na:na]
    at sc.framework.plugins.RoundBasedGameInstance.onAction(RoundBasedGameInstance.java:72) [software_challenge-sdk.jar:na]
    at sc.server.gaming.GameRoom.onEvent(GameRoom.java:473) [softwarechallenge-server.jar:na]
    at sc.server.Lobby.onRequest(Lobby.java:124) [softwarechallenge-server.jar:na]
    at sc.server.network.Client.notifyOnPacket(Client.java:116) [softwarechallenge-server.jar:na]
    at sc.server.network.Client.onObject(Client.java:297) [softwarechallenge-server.jar:na]
    at sc.networking.clients.XStreamClient.receiveThread(XStreamClient.java:148) [software_challenge-sdk.jar:na]
    at sc.networking.clients.XStreamClient$1.run(XStreamClient.java:98) [software_challenge-sdk.jar:na]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_151]

Log:

first part (BLUE): step: 0, to hare
first part (RED): step: 0, eat salad
first part (BLUE): step: 0, to pos2
first part (RED): step: 1, to hare
first part (BLUE): step: 0, to salad
first part (RED): step: 1, to pos1
first part (BLUE): step: 0, eat salad
first part (RED): step: 1, to carrot
first part (BLUE): step: 1, to salad
first part (RED): step: 0, eat carrot
first part (BLUE): step: 0, eat salad
first part (RED): step: 1, to carrot
first part (BLUE): step: 2, to carrot !!!!! Now playing: SecondPart
first part (RED): step: 0, eat carrotsecond part (BLUE): goto position 1 or 2
first part (RED): step: 1, to saladsecond part (BLUE): goto carrots 3 40
first part (RED): step: 0, eat saladsecond part (BLUE): exchange carrots: +10 or -10
first part (RED): step: 2, to pos1 !!!!! Now playing: SecondPartsecond part (BLUE): goto carrots 28 49second part (RED): goto carrots 3 15second part (BLUE): exchange carrots: +10 or -10second part (RED): exchange carrots: +10 or -10second part (BLUE): goto saladsecond part (RED): playing card

(RED): playing card => SecondPart (Z.68 - 73):

if(p.ownsCardOfType(CardType.EAT_SALAD)) actions.add(new Card(CardType.EAT_SALAD,1));
                    else if(p.getCarrots()<=10&&p.ownsCardOfType(CardType.TAKE_OR_DROP_CARROTS)) actions.add(new Card(CardType.TAKE_OR_DROP_CARROTS,20));
                    else if(p.getCarrots()>=80&&p.ownsCardOfType(CardType.TAKE_OR_DROP_CARROTS)) actions.add(new Card(CardType.TAKE_OR_DROP_CARROTS,-20));
                    else if(enemy_fields[0]&&p.ownsCardOfType(CardType.HURRY_AHEAD)) actions.add(new Card(CardType.HURRY_AHEAD,1));

Hier fehlt am Ende ein else, da aber nicht möglich musst du vorher prüfen, ob eine Bedingung erfüllt ist und dann erste in das else if in Zeile 67 gehen

EasyDevCpp commented 7 years ago

Kein signifikanter Fehler, niedrige Priorität.