Skip to content

GameEvaluation

CodingGlad edited this page Dec 31, 2022 · 1 revision

public class GameEvaluation

This method is an evaluation system that controls the whole game of Code Soccer.

public GameEvaluation(SoccerGame game, Opponent opponentTop, Opponent opponentBottom)

This constructor is used for initialization of an evaluation system for code soccer.

It has only one restriction and that is that it needs two opponents of different GaolLocationType. If this restriction isn't fulfilled, an IllegalStateException is thrown.

  • Parameters:
    • game — template that evaluation system has to follow.
    • opponentTop — player whose goal is located on top of the field.
    • opponentBottom — player whose goal is located on bottom of the field.

public Opponent play()

Method used to start the game.

  • Returns: winner of finished game

private void turnOutput(boolean turn)

Method for informing players about their turns.

  • Parameters: turn — whose purpose is to identify which players turn it is.

private boolean changePlayers(boolean turn, FieldPoint point)

Method for changing turn of both players based on the bounce mechanic.

  • Parameters:
    • turn — which represents which players turn it is
    • point — which bounce is checked in order to correctly change players
  • Returns: boolean representation of next players turn

private int isGameFinished(boolean turn, FieldPoint destination)

Method that checks whether a game has fulfilled requirements for an end.

  • Parameters:
    • turn — that represents whose turn it is.
    • destination — of a ball.
  • Returns: 1 if top player won, -1 if bottom player won, otherwise 0.

Clone this wiki locally