com.antelmann.game.muehle
Class MuehlePosition
java.lang.Object
com.antelmann.game.GameBoardPosition
com.antelmann.game.muehle.MuehlePosition
- All Implemented Interfaces:
- Serializable, Cloneable
public class MuehlePosition
- extends GameBoardPosition
The class MuehlePosition represents a Muehle game position.
The representation is an integer
based on the following little ASCII graphic:
00----------01----------02
| | |
| 08------09------10 |
| | | | |
| | 16--17--18 | |
| | | | | |
07--15--23 19--11--03
| | | | | |
| | 22--21--20 | |
| | | | |
| 14------13------12 |
| | |
06----------05----------04
- Author:
- Holger Antelmann
- See Also:
- Serialized Form
NUMBER_OF_FIELDS
public static int NUMBER_OF_FIELDS
MuehlePosition
public MuehlePosition(int pos)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
isValidPosition
public static boolean isValidPosition(int p)
getMuehlePairs
public int[] getMuehlePairs()
- returns getMuehlePairs(asInteger())
getMuehlePairs
public static int[] getMuehlePairs(int pos)
- As every potential muehle is closed by two pairs of 2 other
positions having a piece of the same color, getMuehlePairs()
returns an array of integers that represent the two pairs of
Positions that fullfill this condition.
- Returns:
- an int[] with 4 elememts; the first two array elements
represent the first position pair to potentially close the muehle,
the next two elements represent the second position pair - or null
if the given pos is not valid.
connectsTo
public boolean connectsTo(MuehlePosition pos)
connectsTo
public boolean connectsTo(int pos)
getConnections
public int[] getConnections()
- returns getMuehlePairs(asInteger())
getConnections
public static int[] getConnections(int pos)
toString
public String toString()
- Overrides:
toString in class GameBoardPosition
(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads