View Javadoc

1   /*
2    * AI Soccer Project - network gaming environment for AI warriors.
3    * Copyright (C) 2001-2004  Marcin Werla, Pawel Widera
4    *
5    * This program is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU General Public License
7    * as published by the Free Software Foundation; either version 2
8    * of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, you can find it here:
17   * http://www.gnu.org/licenses/gpl.html
18   */
19  
20  package aigames.soccer.field;
21  
22  import aigames.soccer.InvalidMoveException;
23  import aigames.soccer.Move;
24  
25  import java.awt.Point;
26  
27  
28  /***
29   * This interface represents field for soccer game.
30   * @version $Id: GameField.java,v 1.7 2004/05/08 21:55:25 mwerla Exp $
31   */
32  public interface GameField {
33      /***
34       * Makes move for a proper player.
35       * @param move Move that will be made.
36       * @param color Color for the new move.
37       * @throws InvalidMoveException Thrown when move is invalid
38       * for current game field state.
39       */
40      public void makeMove(Move move, int color) throws InvalidMoveException;
41  
42      /***
43       * Returns current position of a ball.
44       * @return Current position of a ball.
45       */
46      public Point getCurrentPosition();
47  
48      /***
49       * Sets the ball in the starting position of the field
50       * and sets starting player according to given parameter.
51       */
52      public void startGame();
53  
54      /***
55       * Checks if there is game over.
56       * @return True if there is game over, otherwise false.
57       */
58      public boolean isGameOver();
59  
60      /***
61       * Checks if there is ball deadlock.
62       * @return True if there is ball deadlock, otherwise false.
63       */
64      public boolean isDeadLock();
65  
66      /***
67       * Checks if there is goal.
68       * @return -1 (left side) or 1 (right side) if there is goal, otherwise 0.
69       */
70      public int isGoal();
71  
72      /***
73       * Returns number of moves for a given color.
74       * @param color Color to check.
75       * @return Number of moves for a given color.
76       */
77      public int getNumberOfMoves(int color);
78  
79      /***
80       * Returns average move length for a given color.
81       * @param color Color to check.
82       * @return Average move length for a given color.
83       */
84      public float getAvgMoveLength(int color);
85  
86      /***
87       * Returns field point at given coordinates.
88       * @param x X point coordinate.
89       * @param y y point coordinate.
90       * @return Field point at given coordinates.
91       */
92      public FieldPoint getFieldPoint(int x, int y);
93  
94      /***
95       * Returns maximum X index.
96       * @return Maximum X index
97       */
98      public int getMaximumXIndex();
99  
100     /***
101      * Returns maximum Y index.
102      * @return Maximum Y index
103      */
104     public int getMaximumYIndex();
105 }