Games\GamesByEmail.jsGamesByEmailObject
All Implemented Interfaces:
GamesByEmail.Hex
implementsFoundation.Interface
An interface for games with a hexagonal board. Has precedent methods to for converting to and from screen points, and board point to value indices, path and looping. A class should also implement either GamesByEmail.HexH or GamesByEmail.HexV.
| Note: This interface should be implemented, not extended. Do not pass as first argument to Foundation.createClass function. |
See Also:
| Method Summary | |
precedence |
Gets the board point from a screen coordinates.
|
precedence |
Gets the board point from the board value index.
|
|
|
precedence |
Calls a method of the game for each point on the board, with the board point as the first parameter. The looping stops if the method returns an expression that evaluates to true.
|
precedence |
Counts the number of non-blank values lie in between two points. The points must be separated in one of the 6 hexorthogonal directions.
|
precedence |
Gets the screen rectangle from board coordinates.
|
private static |
|
precedence |
Gets the board value at a coordinate.
|
Methods inherited from Foundation.Interface |
getTypePath |
| Method Detail |
precedence Point boardPointFromScreenXY(/*Number*/ screenX,
/*Number*/ screenY)
Gets the board point from a screen coordinates.
Parameters:screenX -The x coordinate, in screen space.
screenY -The y coordinate, in screen space.
precedence Point boardPointFromValueIndex(/*Number*/ index)
Gets the board point from the board value index.
Parameters:index -The board value index.
dispose()
dispose in class Interface
precedence Variant forEachBoardPoint(/*String*/ methodName,
/*Variant*/ parameters,
...)
Calls a method of the game for each point on the board, with the board point as the first parameter. The looping stops if the method returns an expression that evaluates to true.
Parameters:methodName -The name of the game method to call.
parameters -(Optional)(Repeatable) Additional parameters to pass to the method after the board point.
null.
precedence Number numInPath(/*Point*/ toPoint,
/*Point*/ fromPoint,
/*String*/ board)
Counts the number of non-blank values lie in between two points. The points must be separated in one of the 6 hexorthogonal directions.
Parameters:toPoint -One end of the straight line.
fromPoint -One end of the straight line.
board -The board string (a representation of the board state as a string).
toPoint and fromPoint.fromPoint and toPoint must be separated in one of the 6 hexorthogonal directions. Pieces on fromPoint or toPoint are not counted.
precedence Rectangle screenRectFromBoardXY(/*Number*/ boardX,
/*Number*/ boardY)
Gets the screen rectangle from board coordinates.
Parameters:boardX -The x coordinate, in board point space.
boardY -The y coordinate, in board point space.
private static $setSides(hex,
args)
hex -
args -
precedence String valueIndexFromBoardXY(/*Number*/ x,
/*Number*/ y,
/*String*/ board)
Gets the board value at a coordinate.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).