File: Games\GamesByEmail.js

GamesByEmail
Class Game

Object
  
 
 
GamesByEmail.Game

All Implemented Interfaces:

Class, Elemental, Resourceful, Server


GamesByEmail.Game

implements Foundation.Class, Foundation.Elemental, Foundation.Resourceful, Foundation.Server

Base class for all games.


Constructor Summary
GamesByEmail.Game()

Field Summary
Objectboard
The data from the board entry of the resourcePack.
BooleancanPie
Whether the game supports pieing.
Rectangleconstrainer
A rectangle to constrain piece movement.
Stringfont
The font to use throughout the game. Defaults to the player's font preference.
Numberid
The unique ID for a game.
Infoinfo
The game specific state data.
BooleanisLog
Whether the game is a log (display only for a game log page) or a playing game .
DatelastMove
The date and time of the last move made in the game.
LogSettingslogSettings
Various settings for altering the log display.
NumbermaxMoveNumber
The number of moves made in the game.
Stringmessage
The message between all the players of the game.
Movemove
The last move of the game.
GameNotifynotify
The notification types in the game.
StringonLeftMouseDown
The name of a method of the game to call when the left mouse button is pressed over the board, or null.
StringonLeftMouseUp
The name of a method of the game to call when the left mouse button is released over the board, or null.
StringonMiddleMouseDown
The name of a method of the game to call when the middle mouse button is pressed over the board, or null.
StringonMiddleMouseUp
The name of a method of the game to call when the middle mouse released is pressed over the board, or null.
StringonMouseDown
The name of a method of the game to call when a mouse button is pressed over the board, or null.
StringonMouseMove
The name of a method of the game to call when the mouse moves over the board area, or null.
StringonMouseOut
The name of a method of the game to call when the mouse exits the board area, or null.
StringonMouseOver
The name of a method of the game to call when the mouse enters the board area, or null.
StringonMouseUp
The name of a method of the game to call when a mouse button is released over the board, or null.
StringonRightMouseDown
The name of a method of the game to call when the right mouse button is pressed over the board, or null.
StringonRightMouseUp
The name of a method of the game to call when the right mouse button is released over the board, or null.
Piecespieces
A collection of pieces of the class declared in the resource pack.
Booleanpreviewing
Whether the game is in previewing mode (production) or is a real game.
static ObjectresourcePack
Resources for most of the game. Override to add resources specific to game.
Numberrotation
The orientation of the board, in radians. Set to the current player's perspective.
GameStatusstatus
The status of the game.
Teamsteams
The top level teams in the game.
Territoriesterritories
A collection of territories of the class declared in the resource pack.
Booleantesting
Whether the game is in testing mode (development) or is a real game.
Stringtitle
The title of the game.
GAME_TYPEtype
The type of game.
Booleanverbose
The verbosity level to use throughout the game. Defaults to the player's verbose preference.

Fields inherited from Foundation.Elemental
$Foundation_$registry_index

Method Summary
StringaboveTeamTitleRowHtml(/*Number*/ numCols)
Gets any HTML for an information row to be displayed above the top team titles.
StringacceptDeclineDrawHtml(/*String*/ resourceName)
Called when needing the accept-or-decline-draw prompts HTML (typically a short sentence and an Accept Draw button). Override to set. Internally uses the "acceptOrDeclineDraw" resource.
voidacceptDraw()
Accepts a draw. Ends the game and sends the move.
StringacceptDrawButtonHtml()
Creates HTML for an Accept Draw button.
voidaddNote(/*String*/ note)
Call to add a note in the game message when sending a move.
static GameaddToPage(/*String*/ elementId, /*String*/ gameId)
Creates a new game and inserts the HTML into an existing element on the page.
StringBuilderappendAdditionalPreferencesHtml(/*StringBuilder*/ htmlBuilder)
Override to add additional player preferences.
StringBuilderappendBoardHtml(/*StringBuilder*/ htmlBuilder)
Appends the HTML for the game board (usually an image) and the pieces or territories on it.
StringbeginTurnHtml()
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: drawDeclinedHtml, itsYourTurnHtml, pieHtml, acceptDeclineDrawHtml, offerDrawHtml, cancelGameHtml and resignHtml.
StringbelowTeamTitleRowHtml(/*Number*/ numCols)
Gets any HTML for an information row to be displayed below the bottom team titles.
PointboardPointFromScreenPoint(/*Point*/ screenPoint)
Gets the board point from a screen point.
PointboardPointFromScreenXY(/*Number*/ screenX, /*Number*/ screenY)
Gets the board point from a screen coordinates.
PointboardPointFromValueIndex(/*Number*/ index)
Gets the board point from the board value index.
StringboardValueFromValueColor(/*String*/ value, /*Number*/ color)
Gets the board value from a value and color. By default, the value is returned if color is zero, else the upper case of the value is returned.
StringcancelGameButtonHtml()
Creates HTML for a Cancel This Game button.
StringcancelGameHtml(/*String*/ resourceName)
Called when needing the you-may-cancel-the-game prompts HTML (typically a short sentence about canceling before the first move is made, and a Cancel This Game button). Override to set. Internally uses the "youMayCancelTheGame" resource.
BooleancheckMove(/*Point*/ toPoint, /*Point*/ fromPoint)
Checks to see if a move is legal. By default calls isMoveLegal.
voidclearHilites(/*Boolean*/ unclear)
Hides all images that were created with hiliteImageHtml.
voidclearMouseEvents()
Clears all mouse events of the game and its territories (if applicable).
StringcloseWindowButtonHtml()
Creates HTML for a Close Window button.
StringcloseWindowHtml()
Called when needing the start-another-game prompt HTML (typically a short sentence with a Close Window button). Override to set. Internally uses the "youMayStartAnotherGame" resource.
NumbercolorFromBoardValue(/*String*/ boardValue)
Gets the color from a board value. By default, lower case characters return 0, uppercase 1, and everything else -1.
NumbercolorFromPointBoard(/*Point*/ point, /*String*/ board)
Gets the color of the value of a board string at a board point.
NumbercolorFromXYBoard(/*Number*/ x, /*Number*/ y, /*String*/ board)
Gets the color of the value of a board string at an x,y coordinate.
StringcompleteTurnHtml()
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: undoMoveHtml, completeYourTurnHtml, offerDrawHtml and sendMoveHtml.
StringcompleteYourTurnHtml(/*String*/ resourceName)
Called when needing the complete-your-turn game prompt HTML (typically a short sentence about the move and a Send This Move button). Override and set mouse events here. Internally uses the "completeYourTurn" resource.
PointconstrainPoint(/*Point*/ screenPoint)
Constrains a screen point by the constrainer property (if set).
RectangleconstrainRectangle(/*Rectangle*/ screenRect)
Constrains a screen rectangle by the constrainer property (if set).
StringcontinueTurnHtml()
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: undoMoveHtml, continueYourTurnHtml, offerDrawHtml and sendMoveHtml.
StringcontinueYourTurnHtml(/*String*/ resourceName)
Called when needing the continue-your-turn game prompt HTML (typically a short sentence about the move, no send move button yet). Override and set mouse events here. Internally uses the "continueYourTurn" resource.
Booleandebug(/*String*/ value)
Writes a message to the message area.
ArraydiceRolls(/*Number*/ num)
Returns die rolls from the Dice-O-Matic if in production, else pseudo-random integers from 1 to 6 inclusive.
NumberdieRoll()
Returns a pseudo-random integer from 1 to 6 inclusive.
 dispose()
StringdrawAcceptedHeaderHtml(/*String*/ resourceName)
Called when needing the draw-accepted header HTML. Override to set. Internally uses the "drawGameHeader" resource.
StringdrawAcceptedHtml(/*String*/ resourceName)
Called when needing the they-accepted-the-draw game prompts HTML. Override to set. Internally uses the "theyAcceptedTheDraw" resource.
StringdrawDeclinedHeaderHtml(/*String*/ resourceName)
Called when needing the draw-declined header HTML. Override to set. Internally uses the "drawDeclinedHeader" resource.
StringdrawDeclinedHtml(/*String*/ resourceName)
Called when needing the draw-declined prompt HTML (typically a short sentence about the draw being declined). Override to set. Internally uses the "theyDeclinedTheDraw" resource.
StringdrawOfferedHeaderHtml(/*String*/ resourceName)
Called when needing the draw-offered header HTML. Override to set. Internally uses the "drawOfferedHeader" resource.
StringelementTitleAttributes(/*String*/ title)
Generates HTML element attributes necessary to have an HTML hover title on an element.
PlayerfindNextPlayer(/*Player*/ player)
Finds the next player.
PlayerfindPlayer()
Finds a player by their GamesByEmail.Player.id.
TeamfindWinningTeam()
Finds the team that won the game.
VariantforEachBoardPoint(/*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.
VariantforEachTeam(/*String*/ methodName)
Calls a method of the game for each team, with the team as the only parameter. The looping stops if the method returns an expression that evaluates to true.
StringgameInProgressHeaderHtml(/*String*/ resourceName)
Called when needing the game-in-progress header HTML. Override to set. Internally returns either drawOfferedHeaderHtml, drawOfferedHeaderHtml or turnHeaderHtml.
StringgameOverHeaderHtml(/*String*/ resourceName)
Called when needing the game-over header HTML. Override to set. Internally returns either tieGameHeaderHtml, drawAcceptedHeaderHtml, resignedHeaderHtml or wonHeaderHtml.
StringgameOverHtml()
Called when needing the game-over game prompts HTML. Override to set. Internally returns one of the following: theyResignedHtml, youResignedHtml, youTiedHtml, drawAcceptedHtml, youWinHtml or youLoseHtml.
StringgetActionLinksHtml()
Creates HTML for a action links: Open log, open rules, open preferences, and report problem anchors.
StringgetAnchorHtml(/*String*/ title, /*String*/ id, /*String*/ eventCode, /*String*/ attributes)
Creates HTML for an <A ...> element.
StringgetButtonHtml(/*String*/ title, /*String*/ id, /*String*/ eventCode, /*String*/ clickTitle, /*String*/ attributes, /*String*/ styles)
Creates HTML for a <INPUT TYPE=BUTTON ...> element.
StringgetCheckboxHtml(/*Boolean*/ checked, /*String*/ id, /*String*/ eventCode, /*String*/ attributes)
Creates HTML for a <INPUT TYPE=CHECKBOX ...> element.
StringgetGamePromptsHtml()
Called when needing the game prompts HTML. Override to set. Internally clears the mouse events, then returns either spectatingHtml, gameOverHtml, notYourTurnHtml or getTurnHtml.
StringgetHeaderHtml(/*String*/ resourceName)
Called when needing the header HTML. Override to set. Internally returns either gameInProgressHeaderHtml or gameOverHeaderHtml.
StringgetHtml()
Gets the HTML of the entire game.
StringgetHtmlButtonHtml(/*String*/ id, /*String*/ eventCode, /*String*/ attributes)
Creates HTML for a <BUTTON ...> element.
StringgetImageSrc(String)
Gets the fully qualified path for an image in the board folder.
ArraygetNewGamePlayerOrder(/*Array*/ userInfo)
Orders the players for the next game. By default the user information is reversed.
StringgetNextGamesTitle()
Gets the title for the next game. By default, the current game's title is appended with '- Round X'.
StringgetOptionHtml(/*String*/ title, /*String*/ value, /*String*/ defaultValue)
Creates HTML for an <OPTION ...> element.
NumbergetPieType()
Called when needing the new game type to pie a game. Internally finds the current game type in the first half of the array 'gameTypes' in the resourcePack, and returns the type in the same position in the second half of the array. Override to alter.
RectanglegetPieceRect(/*String*/ value, /*Number*/ color, /*Point*/ boardPoint)
Gets the clipping rectangle for a piece.
StringgetPieceSrc()
Gets the fully qualified path for the piece image.
StringgetRadioHtml(/*Boolean*/ checked, /*String*/ id, /*Number*/ index, /*String*/ eventCode, /*String*/ attributes)
Creates HTML for a <INPUT TYPE=RADIO ...> element.
StringgetSelectHtml(/*String*/ id, /*String*/ eventCode, /*String*/ attributes)
Creates HTML for a <SELECT ...> element.
StringgetSpectatorAnchorHtml()
Creates HTML for a Spectator anchor.
StringgetSpectatorUrl()
Gets the URL for spectating this game.
TeamgetTeamAtDistance(/*Number*/ distance)
Gets the team that is a set number of places away in the parent teams colection, wrapping if necessary.
StringgetTeamFontColor(/*Team*/ team)
Gets the team display color, such as #ff0000.
StringgetTeamLogFontBgColor(/*Team*/ team)
Gets the team background-color for the game log, such as #ff8888.
StringgetTeamLogFontColor(/*Team*/ team)
Gets the team display color for the game log, such as #ff0000.
StringgetTeamTitleAlignment(/*Team*/ team, /*Boolean*/ top, /*Number*/ index, /*Number*/ numTeams)
Gets the alignment for a team title. Defaults to "center".
StringgetTeamTitleHtml(/*Team*/ team, /*Boolean*/ top)
Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.
StringgetTeamTitlesHtml(/*Boolean*/ top)
Gets the HTML for the team titles on the board.
ArraygetTeamsForTitles(/*Boolean*/ top)
Gets an array of teams to display either across the top or bottom of the board. Override to alter default behavior.
StringgetTextHtml(/*String*/ value, /*String*/ id, /*String*/ attributes)
Creates HTML for a <INPUT TYPE=TEXT ...> element.
StringgetTextareaHtml(/*String*/ id, /*String*/ attributes)
Creates HTML for a <TEXTAREA ...> element.
StringgetTurnHtml()
Called when needing the it-is-your-turn game prompts HTML. Override to set. Internally returns either beginTurnHtml, continueTurnHtml or completeTurnHtml.
TeamgetTurnTeam()
Finds the first team whose turn it is.
StringgetVButtonHtml(/*String*/ title, /*String*/ id, /*String*/ eventCode, /*String*/ attributes, /*String*/ styles)
Creates HTML for a vertical button, based on an <BUTTON ...> element.
voidhandleMoveCollision(/*Object*/ gameData, /*Array*/ collisionMoves)
Override to handle move collisions from concurrent turns.
StringhiliteImageHtml(/*Point*/ boardPoint, /*Rectangle*/ clipRect)
Creates HTML for a highlight image.
voidinitialize(/*Number*/ numPlayers, /*Number*/ turnTeamIndex)
The first method to be called when a game is created, override to set up teams, players and the game state.
voidinitializeNewGameForm(/*GameForm*/ gameForm, /*Array*/ userInfo)
Seeds the game form options with values from the current game.
PointisBoardPointHidden(/*Point*/ boardPoint)
Returns whether the board point is hidden from the current player, for games like Dark Chess.
NumberisColorAtPoint(/*Point*/ point, /*String*/ board, /*Number*/ color)
Checks if the color of the value of a board string at a point is a color.
NumberisColorAtXY(/*Number*/ x, /*Number*/ y, /*String*/ board, /*Number*/ color)
Checks if the color of the value of a board string at a coordinate is a color.
BooleanisMyTurn(/*Boolean*/ checkEverything)
Checks to see if it is the current player's turn.
BooleanisPathClear(/*Point*/ toPoint, /*Point*/ fromPoint, /*String*/ board)
Checks to see if all blank values lie in between two points. The points must be separated in one of the 8 orthogonal or diagonal directions.
BooleanisPointBoardClear(/*Point*/ point, /*String*/ board)
Checks to see if a board string is clear at an x,y coordinate.
BooleanisPointOnBoard(/*Point*/ point)
Checks to see if a board point is on the board.
NumberisValueColorAtPoint(/*Point*/ point, /*String*/ board, /*String*/ value, /*Number*/ color)
Checks if the color of the value of a board string at a point is a color.
NumberisValueColorAtXY(/*Number*/ x, /*Number*/ y, /*String*/ board, /*String*/ value, /*Number*/ color)
Checks if the color of the value of a board string at a coordinate is a color.
BooleanisXYBoardClear(/*Number*/ x, /*Number*/ y, /*String*/ board)
Checks to see if a board string is clear at an x,y coordinate.
BooleanisXYOnBoard(/*Number*/ x, /*Number*/ y)
Checks to see if an x,y coordinate is on the board.
StringitsYourTurnHtml(/*String*/ resourceName)
Called when needing the it-is-your-turn game prompt HTML (typically a short sentence about the move). Override and set mouse events here. Internally uses the "itIsYourTurnToMove" resource.
voidmaybePie()
Called when the Pie button is pressed, opening a confirmation box to proceed with the pie.
voidmaybeResign()
Called when the Resign button is pressed, opening a confirmation box to proceed with the resign.
StringmovePiece(/*Point*/ toPoint, /*Point*/ fromPoint, /*String*/ board)
Moves a value in a board string to another point.
TeamnextTeam(/*Boolean*/ playing)
Finds the next team from the current player.
StringnotYourTurnHtml(/*String*/ resourceName)
Called when needing the it-is-not-your-turn game prompt HTML (typically a short sentence with Send Reminder, Refresh Game and Close Window buttons Start Another Game button). Override to set. Internally uses the "notYourTurn" resource.
NumbernumInPath(/*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 8 orthogonal or diagonal directions.
NumbernumTeamsPlaying()
Counts the number of teams still playing.
StringofferDrawCheckBoxHtml()
Creates HTML for an Offer Draw checkbox.
StringofferDrawHtml(/*String*/ resourceName)
Called when needing the offer-a-draw-with-this-move prompts HTML (typically a short sentence and a Offer A Draw checkbox). Override to set. Internally uses the "youMayOfferDraw" and "offerDrawWithThisMove" resources.
StringopenLogAnchorHtml()
Creates HTML for a Open Game Log anchor.
StringopenPlayerChatAnchorHtml(/*String*/ id, /*String*/ attributes, /*Number*/ chatId, ...)
Creates HTML for a Open Chat anchor.
StringopenPreferencesAnchorHtml()
Creates HTML for a Open Prefereneces anchor.
StringopenRulesAnchorHtml(/*Number*/ index)
Creates HTML for an Open Rules anchor.
voidpie()
Pies the game. Clears mouse events and sends.
StringpieButtonHtml()
Creates HTML for a Pie button.
StringpieHtml(/*String*/ resourceName)
Called when needing the you-may-pie game prompt HTML (typically a short sentence about pieing and a Pie button). Override and set. Internally uses the "youMayPie" resource.
BooleanprocessSecureMove(/*GamesByEmail*/ game)
Gets called when the sending moves, fir processing secure move data on the client. Override to process secure data.
voidrefreshGame()
Gets the latest game data from the server, also checks to make sure the game script files are up-to-date.
StringrefreshGameButtonHtml()
Creates HTML for a Refresh Game button.
StringreportProblemAnchorHtml()
Creates HTML for a Report Problem anchor.
voidresign()
Resignes the current player. Clears mouse events, sets the player as resigned, and sends the move.
StringresignButtonHtml()
Creates HTML for a Resign button.
StringresignHtml(/*String*/ resourceName)
Called when needing the you-may-resign prompt HTML (typically a short sentence about resiging and a Resign button). Override to set. Internally uses the "youMayResign" resource.
StringresignedHeaderHtml(/*String*/ resourceName)
Called when needing the resigned header HTML. Override to set. Internally uses the "resignedHeader" resource.
RectanglescreenRectFromBoardPoint(/*Point*/ boardPoint)
Gets the screen rectangle from a board point.
RectanglescreenRectFromBoardXY(/*Number*/ boardX, /*Number*/ boardY)
Gets the screen rectangle from board coordinates.
BooleansendMove(/*Boolean*/ sendNow, /*Player*/ player)
Gets called when the Send Move button is pushed. Override and set the game state, then call Super.sendMove.
StringsendMoveButtonHtml()
Creates HTML for a Send This Move button.
StringsendMoveHtml(/*String*/ resourceName)
Called when needing the send-this-move prompts HTML (typically a short sentence and a Send This Move button). Override to set. Internally uses the "youMaySendYourMove" resource.
StringsendReminderButtonHtml()
Creates HTML for a Send Reminder button.
voidsetConstrainer()
Sets the constrainer property.
voidsetEnded(/*Team*/ winningTeam)
Sets the game as ended.
voidsetFloatHtml(/*String*/ html, /*Number*/ width, /*Number*/ height)
Shows HTML in a simple box centered over the board. Board mouse messages are suspended while box is shown.
voidsetInnerHtml(/*Element|String*/ element)
Sets the inner HTML of an element.
voidsetMouseHtml(/*String*/ html, /*Number*/ width, /*Number*/ height)
Shows HTML in a simple box that follows the mouse around. The user will not be able to click on this box, it is for showing information only.
voidsetPerspective(/*Team*/ team)
Called when synchronizing, sets the perspective of the board based on the player. By default sets the rotation property to 0.
voidsetPlayerPrefs()
Extract the player's preferences from the player.info collection, and sets properties accordingly. By default, the font and verbose properties are extracted.
StringsetValueAtPoint(/*Point*/ point, /*String*/ board, /*String*/ value)
Sets a board string at a board point to a value.
StringsetValueAtXY(/*Number*/ x, /*Number*/ y, /*String*/ board, /*String*/ value)
Sets a board string at a coordinate to a value.
voidshowTransactionPrompt(/*String*/ resourceName)
Shows the a tranaction message (Sending Move, Initializing, etc.).
StringspectatingHtml()
Called when needing the you-are-spectating game prompts HTML. Override to set. Internally returns the following combined: refreshGameButtonHtml and closeWindowButtonHtml.
StringstartAnotherGameButtonHtml()
Creates HTML for a Start Another Game button.
StringstartAnotherGameHtml(/*String*/ resourceName)
Called when needing the start-another-game prompt HTML (typically a short sentence with a Start Another Game button). Override to set. Internally uses the "youMayStartAnotherGame" resource.
voidsynch()
Called when the game should synchronize with info properties from the server.
voidsynchTeam(/*Team*/ team)
Called to synchronize the team properties with the raw team data. Just the color and title properties are set by default, override to set more.
NumberteamColorFromTeam(/*Team*/ team)
Gets the team color.
StringtheyResignedHtml(/*String*/ resourceName)
Called when needing the they-resigned game prompts HTML. Override to set. Internally uses the "theyResigned" resource.
StringtieGameHeaderHtml(/*String*/ resourceName)
Called when needing the tie-game header HTML. Override to set. Internally uses the "tieGameHeader" resource.
StringtitleFromTeamColor(/*Number*/ color)
Gets the team title from a color.
 transformHashLinksToOnClicks(html)
StringturnHeaderHtml(/*String*/ resourceName)
Called when needing the it's-your-turn header HTML. Override to set. Internally uses the "turnHeader" resource.
voidundo(/*Boolean*/ skipUpdate)
Undos all moves since the last synch method call. The synch and update methods will be called again.
StringundoButtonHtml(/*String*/ resourceName)
Creates HTML for a Undo button.
StringundoMoveHtml(/*String*/ resourceName)
Called when needing the undo-this-move prompts HTML (typically a short sentence and an Undo button). Override to set. Internally uses the "youMayUndoYourMove" resource.
voidupdate()
Updates the team titles, the game header, the game title, all prompts and action links.
voidupdateTeamTitles()
Updates the top and bottom team title rows.
StringvalueFromBoardValue(/*String*/ boardValue)
Gets the value from a board value. By default, the lower case of the board value is returned.
StringvalueFromPointBoard(/*Point*/ point, /*String*/ board)
Gets the board value at a board point.
StringvalueFromXYBoard(/*Number*/ x, /*Number*/ y, /*String*/ board)
Gets the board value at a coordinate.
NumbervalueIndexFromBoardPoint(/*Point*/ point)
Gets the board string index of a point.
NumbervalueIndexFromBoardXY(/*Number*/ x, /*Number*/ y)
Gets the board string index of a coordinate.
StringwonHeaderHtml(/*String*/ resourceName)
Called when needing the won-game header HTML. Override to set. Internally uses the "wonHeader" resource.
StringyouLoseHtml(/*String*/ resourceName)
Called when needing the you-lose game prompts HTML. Override to set. Internally uses the "youLose" resource.
StringyouResignedHtml(/*String*/ resourceName)
Called when needing the you-resigned game prompts HTML. Override to set. Internally uses the "youResigned" resource.
StringyouTiedHtml(/*String*/ resourceName)
Called when needing the you-tied game prompts HTML. Override to set. Internally uses the "youTie" resource.
StringyouWinHtml(/*String*/ resourceName)
Called when needing the you-win game prompts HTML. Override to set. Internally uses the "youWin" resource.

Methods inherited from Foundation.Class
getTypePath, isInstanceOf

Methods inherited from Foundation.Elemental
attachEvent, detachEvent, elementId, event, getById, getElement, getElementValue, getElements, getFirst, getNext, parseElementId, processHtml, processHtml

Methods inherited from Foundation.Resourceful
resource, resource, resourceUrl, resourceUrl

Methods inherited from Foundation.Server
server, serverSerialized, serverSynchronous

Constructor Detail

Game

GamesByEmail.Game()

Field Detail

board

Object board

The data from the board entry of the resourcePack.


canPie

Boolean canPie

Whether the game supports pieing.


constrainer

Rectangle constrainer

A rectangle to constrain piece movement.


font

String font

The font to use throughout the game. Defaults to the player's font preference.


id

Number id

The unique ID for a game.


info

Info info

The game specific state data.


isLog

Boolean isLog

Whether the game is a log (display only for a game log page) or a playing game .


lastMove

Date lastMove

The date and time of the last move made in the game.


logSettings

LogSettings logSettings

Various settings for altering the log display.


maxMoveNumber

Number maxMoveNumber

The number of moves made in the game.


message

String message

The message between all the players of the game.


move

Move move

The last move of the game.


notify

GameNotify notify

The notification types in the game.


onLeftMouseDown

String onLeftMouseDown

The name of a method of the game to call when the left mouse button is pressed over the board, or null.


onLeftMouseUp

String onLeftMouseUp

The name of a method of the game to call when the left mouse button is released over the board, or null.


onMiddleMouseDown

String onMiddleMouseDown

The name of a method of the game to call when the middle mouse button is pressed over the board, or null.


onMiddleMouseUp

String onMiddleMouseUp

The name of a method of the game to call when the middle mouse released is pressed over the board, or null.


onMouseDown

String onMouseDown

The name of a method of the game to call when a mouse button is pressed over the board, or null.


onMouseMove

String onMouseMove

The name of a method of the game to call when the mouse moves over the board area, or null.


onMouseOut

String onMouseOut

The name of a method of the game to call when the mouse exits the board area, or null.


onMouseOver

String onMouseOver

The name of a method of the game to call when the mouse enters the board area, or null.


onMouseUp

String onMouseUp

The name of a method of the game to call when a mouse button is released over the board, or null.


onRightMouseDown

String onRightMouseDown

The name of a method of the game to call when the right mouse button is pressed over the board, or null.


onRightMouseUp

String onRightMouseUp

The name of a method of the game to call when the right mouse button is released over the board, or null.


pieces

Pieces pieces

A collection of pieces of the class declared in the resource pack.


previewing

Boolean previewing

Whether the game is in previewing mode (production) or is a real game.


resourcePack

static Object resourcePack

Resources for most of the game. Override to add resources specific to game.

See Also:
Foundation.Resourceful.resource

rotation

Number rotation

The orientation of the board, in radians. Set to the current player's perspective.


status

GameStatus status

The status of the game.


teams

Teams teams

The top level teams in the game.


territories

Territories territories

A collection of territories of the class declared in the resource pack.


testing

Boolean testing

Whether the game is in testing mode (development) or is a real game.


title

String title

The title of the game.


type

GAME_TYPE type

The type of game.


verbose

Boolean verbose

The verbosity level to use throughout the game. Defaults to the player's verbose preference.

Method Detail

aboveTeamTitleRowHtml

String aboveTeamTitleRowHtml(/*Number*/ numCols)

Gets any HTML for an information row to be displayed above the top team titles.

Parameters:
numCols - 
The number of columns of the table the row will belong in, set colspan accordingly.
Returns:
By default returns empty. Override and return '...' to add information.

acceptDeclineDrawHtml

String acceptDeclineDrawHtml(/*String*/ resourceName)

Called when needing the accept-or-decline-draw prompts HTML (typically a short sentence and an Accept Draw button). Override to set. Internally uses the "acceptOrDeclineDraw" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

acceptDraw

void acceptDraw()

Accepts a draw. Ends the game and sends the move.


acceptDrawButtonHtml

String acceptDrawButtonHtml()

Creates HTML for an Accept Draw button.

Returns:
HTML for the button.

addNote

void addNote(/*String*/ note)

Call to add a note in the game message when sending a move.

Parameters:
note - 
The note to add. The notes for the move will be combined and grouped in the game message window.

addToPage

static Game addToPage(/*String*/ elementId,
                      /*String*/ gameId)

Creates a new game and inserts the HTML into an existing element on the page.

Parameters:
elementId - 
The container element to hold the game.
gameId - 
The id of the game to load.
Returns:
The new game.

appendAdditionalPreferencesHtml

StringBuilder appendAdditionalPreferencesHtml(/*StringBuilder*/ htmlBuilder)

Override to add additional player preferences.

Parameters:
htmlBuilder - 
The string builder to add the extra player preference HTML to.
Returns:
The string builder.

appendBoardHtml

StringBuilder appendBoardHtml(/*StringBuilder*/ htmlBuilder)

Appends the HTML for the game board (usually an image) and the pieces or territories on it.

Parameters:
htmlBuilder - 
The builder to append the HTML for the board.
Returns:
The HTML builder passed in.

beginTurnHtml

String beginTurnHtml()

Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: drawDeclinedHtml, itsYourTurnHtml, pieHtml, acceptDeclineDrawHtml, offerDrawHtml, cancelGameHtml and resignHtml.

Returns:
HTML for the game prompts.

belowTeamTitleRowHtml

String belowTeamTitleRowHtml(/*Number*/ numCols)

Gets any HTML for an information row to be displayed below the bottom team titles.

Parameters:
numCols - 
The number of columns of the table the row will belong in, set colspan accordingly.
Returns:
By default returns empty. Override and return '...' to add information.

boardPointFromScreenPoint

Point boardPointFromScreenPoint(/*Point*/ screenPoint)

Gets the board point from a screen point.

Parameters:
screenPoint - 
The screen point.
Returns:
The board point.

boardPointFromScreenXY

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.
Returns:
The board point.

boardPointFromValueIndex

Point boardPointFromValueIndex(/*Number*/ index)

Gets the board point from the board value index.

Parameters:
index - 
The board value index.
Returns:
The board point.

boardValueFromValueColor

String boardValueFromValueColor(/*String*/ value,
                                /*Number*/ color)

Gets the board value from a value and color. By default, the value is returned if color is zero, else the upper case of the value is returned.

Parameters:
value - 
The value.
color - 
The color.
Returns:
The board value.

cancelGameButtonHtml

String cancelGameButtonHtml()

Creates HTML for a Cancel This Game button.

Returns:
HTML for the button.

cancelGameHtml

String cancelGameHtml(/*String*/ resourceName)

Called when needing the you-may-cancel-the-game prompts HTML (typically a short sentence about canceling before the first move is made, and a Cancel This Game button). Override to set. Internally uses the "youMayCancelTheGame" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

checkMove

Boolean checkMove(/*Point*/ toPoint,
                  /*Point*/ fromPoint)

Checks to see if a move is legal. By default calls isMoveLegal.

Parameters:
toPoint - 
The board point moving to.
fromPoint - 
The board point moving from.
Returns:
true if the move is legal.
See Also:
isMoveLegal

clearHilites

void clearHilites(/*Boolean*/ unclear)

Hides all images that were created with hiliteImageHtml.

Parameters:
unclear - 
(Optional) Show the highlight images again. Defaults to false (hides the images).
See Also:
hiliteImageHtml

clearMouseEvents

void clearMouseEvents()

Clears all mouse events of the game and its territories (if applicable).

See Also:
onMouseOver, onMouseMove, onMouseOut, onMouseDown, onMouseUp, onLeftMouseDown, onLeftMouseUp, onRightMouseDown, onRightMouseUp, onMiddleMouseDown, onMiddleMouseUp, GamesByEmail.Territories.clearMouseEvents

closeWindowButtonHtml

String closeWindowButtonHtml()

Creates HTML for a Close Window button.

Returns:
HTML for the button.

closeWindowHtml

String closeWindowHtml()

Called when needing the start-another-game prompt HTML (typically a short sentence with a Close Window button). Override to set. Internally uses the "youMayStartAnotherGame" resource.

Returns:
HTML for the game prompts.

colorFromBoardValue

Number colorFromBoardValue(/*String*/ boardValue)

Gets the color from a board value. By default, lower case characters return 0, uppercase 1, and everything else -1.

Parameters:
boardValue - 
The value to check, by default a single character.
Returns:
The color number.

colorFromPointBoard

Number colorFromPointBoard(/*Point*/ point,
                           /*String*/ board)

Gets the color of the value of a board string at a board point.

Parameters:
point - 
The board point to check.
board - 
The board string (a representation of the board state as a string).
Returns:
The color of the board string value at the point.

colorFromXYBoard

Number colorFromXYBoard(/*Number*/ x,
                        /*Number*/ y,
                        /*String*/ board)

Gets the color of the value of a board string at an x,y 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).
Returns:
The color of the board string value at the coordinate.

completeTurnHtml

String completeTurnHtml()

Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: undoMoveHtml, completeYourTurnHtml, offerDrawHtml and sendMoveHtml.

Returns:
HTML for the game prompts.

completeYourTurnHtml

String completeYourTurnHtml(/*String*/ resourceName)

Called when needing the complete-your-turn game prompt HTML (typically a short sentence about the move and a Send This Move button). Override and set mouse events here. Internally uses the "completeYourTurn" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

constrainPoint

Point constrainPoint(/*Point*/ screenPoint)

Constrains a screen point by the constrainer property (if set).

Parameters:
screenPoint - 
The screen point to constrain.
Returns:
The point closest to the constrainer property.
See Also:
Foundation.Rectangle.constrainPoint

constrainRectangle

Rectangle constrainRectangle(/*Rectangle*/ screenRect)

Constrains a screen rectangle by the constrainer property (if set).

Parameters:
screenRect - 
The screen rectangle to constrain.
Returns:
The intersection of the rectangle and the constrainer property.
See Also:
Foundation.Rectangle.constrainRectangle

continueTurnHtml

String continueTurnHtml()

Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: undoMoveHtml, continueYourTurnHtml, offerDrawHtml and sendMoveHtml.

Returns:
HTML for the game prompts.

continueYourTurnHtml

String continueYourTurnHtml(/*String*/ resourceName)

Called when needing the continue-your-turn game prompt HTML (typically a short sentence about the move, no send move button yet). Override and set mouse events here. Internally uses the "continueYourTurn" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

debug

Boolean debug(/*String*/ value)

Writes a message to the message area.

Parameters:
value - 
(Optional) The value to display. Call with no parameters to clear the message board.
Returns:
Always returns true.

diceRolls

Array diceRolls(/*Number*/ num)

Returns die rolls from the Dice-O-Matic if in production, else pseudo-random integers from 1 to 6 inclusive.

Parameters:
num - 
The number of die rolls to return.
Returns:
An array of num numbers number greater than or equal to 1 and less than or equal to 6, generated locally from Math.random.
See Also:
GamesByEmail.Game.diceRolls

dieRoll

Number dieRoll()

Returns a pseudo-random integer from 1 to 6 inclusive.

Returns:
A number greater than or equal to 1 and less than or equal to 6, generated locally from Math.random.
See Also:
GamesByEmail.Game.dieRoll

dispose

dispose()
Overrides:
dispose in class Class

drawAcceptedHeaderHtml

String drawAcceptedHeaderHtml(/*String*/ resourceName)

Called when needing the draw-accepted header HTML. Override to set. Internally uses the "drawGameHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

drawAcceptedHtml

String drawAcceptedHtml(/*String*/ resourceName)

Called when needing the they-accepted-the-draw game prompts HTML. Override to set. Internally uses the "theyAcceptedTheDraw" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

drawDeclinedHeaderHtml

String drawDeclinedHeaderHtml(/*String*/ resourceName)

Called when needing the draw-declined header HTML. Override to set. Internally uses the "drawDeclinedHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

drawDeclinedHtml

String drawDeclinedHtml(/*String*/ resourceName)

Called when needing the draw-declined prompt HTML (typically a short sentence about the draw being declined). Override to set. Internally uses the "theyDeclinedTheDraw" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

drawOfferedHeaderHtml

String drawOfferedHeaderHtml(/*String*/ resourceName)

Called when needing the draw-offered header HTML. Override to set. Internally uses the "drawOfferedHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

elementTitleAttributes

String elementTitleAttributes(/*String*/ title)

Generates HTML element attributes necessary to have an HTML hover title on an element.

Parameters:
title - 
The HTML to dislpay when the user hovers the mouse over the element.
Returns:
The attributes for the title. These include onmouseover, onmouseout and onmousemove assignments.

Example:

var title="<H1>Big bold hover title!</H1>";
html+="<div "+this.elementTitleAttributes(title)+">Hover here to see big text.</div>";

findNextPlayer

Player findNextPlayer(/*Player*/ player)

Finds the next player.

Parameters:
player - 
The player to start looking from, or null to get the first player.
Returns:
The next player in tree order, or null.

findPlayer

Player findPlayer()

Finds a player by their GamesByEmail.Player.id.

Returns:
The player with that id or null.
Notes:
The player GamesByEmail.Player.ids and team GamesByEmail.Team.ids of all opponents will be 0.

findWinningTeam

Team findWinningTeam()

Finds the team that won the game.

Returns:
The winning team or null.

forEachBoardPoint

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.
Returns:
The first expression from the method that evaluated to true, or null.

forEachTeam

Variant forEachTeam(/*String*/ methodName)

Calls a method of the game for each team, with the team as the only parameter. The looping stops if the method returns an expression that evaluates to true.

Parameters:
methodName - 
The name of the game method to call.
Returns:
The first expression from the method that evaluated to true, or null.

gameInProgressHeaderHtml

String gameInProgressHeaderHtml(/*String*/ resourceName)

Called when needing the game-in-progress header HTML. Override to set. Internally returns either drawOfferedHeaderHtml, drawOfferedHeaderHtml or turnHeaderHtml.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use when generating the final HTML.
Returns:
HTML for the header.

gameOverHeaderHtml

String gameOverHeaderHtml(/*String*/ resourceName)

Called when needing the game-over header HTML. Override to set. Internally returns either tieGameHeaderHtml, drawAcceptedHeaderHtml, resignedHeaderHtml or wonHeaderHtml.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

gameOverHtml

String gameOverHtml()

Called when needing the game-over game prompts HTML. Override to set. Internally returns one of the following: theyResignedHtml, youResignedHtml, youTiedHtml, drawAcceptedHtml, youWinHtml or youLoseHtml.

Returns:
HTML for the game prompts.

getActionLinksHtml

String getActionLinksHtml()

Creates HTML for a action links: Open log, open rules, open preferences, and report problem anchors.

Returns:
HTML for the action links.

getAnchorHtml

String getAnchorHtml(/*String*/ title,
                     /*String*/ id,
                     /*String*/ eventCode,
                     /*String*/ attributes)

Creates HTML for an <A ...> element.

Parameters:
title - 
The anchor's title, which will appear in the browser status bar when the mouse hovers over the anchor.
id - 
(Optional) The class-local id of the element.
eventCode - 
(Optional) The code to execute on the onclick event of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the opening of the A element.
Notes:
No inner HTML or closing </A> tag is included, just the opening tag. The inner HTML and closing tag must be added manually to whatever HTML string is being built.

Example:

   html+=this.getHtmlButtonHtml(this.resource("MyAnchorTitle),"MyAnchor",this.event("myAnchorOnclick()"));
   html+="<b>PLEASE</b> click me!";
   html+="</a>;
See Also:
getButtonHtml, getVButtonHtml, getHtmlButtonHtml, getSelectHtml, getOptionHtml, getCheckboxHtml, getRadioHtml, getTextHtml, getTextareaHtml

getButtonHtml

String getButtonHtml(/*String*/ title,
                     /*String*/ id,
                     /*String*/ eventCode,
                     /*String*/ clickTitle,
                     /*String*/ attributes,
                     /*String*/ styles)

Creates HTML for a <INPUT TYPE=BUTTON ...> element.

Parameters:
title - 
The button's title.
id - 
(Optional) The class-local id of the element.
eventCode - 
(Optional) The code to execute on the onclick event of the element.
clickTitle - 
(Optional) The title to show on the button when clicked.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
styles - 
(Optional) Additional CSS style settings for the element if desired.
Returns:
The HTML for the INPUT element.

Example:

   html+=this.getButtonHtml(this.resource("MyButtonTitle"),"MyButton",this.event("myButtonOnclick()"));
See Also:
getHtmlButtonHtml, getVButtonHtml, getAnchorHtml, getSelectHtml, getOptionHtml, getCheckboxHtml, getRadioHtml, getTextHtml, getTextareaHtml

getCheckboxHtml

String getCheckboxHtml(/*Boolean*/ checked,
                       /*String*/ id,
                       /*String*/ eventCode,
                       /*String*/ attributes)

Creates HTML for a <INPUT TYPE=CHECKBOX ...> element.

Parameters:
checked - 
The initial state of the element.
id - 
The class-local id of the element.
eventCode - 
(Optional) The code to execute on the onclick event of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the INPUT element.

Example:

   html+=this.getCheckboxHtml(true,"MyCheckbox",this.event("myCheckboxOnclick()"));
See Also:
getRadioHtml, getButtonHtml, getHtmlButtonHtml, getVButtonHtml, getAnchorHtml, getSelectHtml, getOptionHtml, getTextHtml, getTextareaHtml, GamesByEmail.Game.getCheckboxHtml

getGamePromptsHtml

String getGamePromptsHtml()

Called when needing the game prompts HTML. Override to set. Internally clears the mouse events, then returns either spectatingHtml, gameOverHtml, notYourTurnHtml or getTurnHtml.

Returns:
HTML for the game prompts.

getHeaderHtml

String getHeaderHtml(/*String*/ resourceName)

Called when needing the header HTML. Override to set. Internally returns either gameInProgressHeaderHtml or gameOverHeaderHtml.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use when generating the final HTML.
Returns:
HTML for the header.

getHtml

String getHtml()

Gets the HTML of the entire game.

Returns:
The game's HTML.

getHtmlButtonHtml

String getHtmlButtonHtml(/*String*/ id,
                         /*String*/ eventCode,
                         /*String*/ attributes)

Creates HTML for a <BUTTON ...> element.

Parameters:
id - 
(Optional) The class-local id of the element.
eventCode - 
(Optional) The code to execute on the onclick event of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the opening of the BUTTON element.
Notes:
No inner HTML or closing </BUTTON> tag is included, just the opening tag. The inner HTML and closing tag must be added manually to whatever HTML string is being built.

Example:

   html+=this.getHtmlButtonHtml("MyButton",this.event("myButtonOnclick()"));
   html+="<b>PLEASE</b><br>click<br>me!";
   html+="</button>;
See Also:
getButtonHtml, getVButtonHtml, getAnchorHtml, getSelectHtml, getOptionHtml, getCheckboxHtml, getRadioHtml, getTextHtml, getTextareaHtml

getImageSrc

String getImageSrc(String)

Gets the fully qualified path for an image in the board folder.

Parameters:
String - 
(Optional) image The name of the image file relative to the board folder. If not supplied, the path to the board folder is returned.
Returns:
The image path.

getNewGamePlayerOrder

Array getNewGamePlayerOrder(/*Array*/ userInfo)

Orders the players for the next game. By default the user information is reversed.

Parameters:
userInfo - 
An array of user information as currently in this game.
Returns:
An array of user information.

getNextGamesTitle

String getNextGamesTitle()

Gets the title for the next game. By default, the current game's title is appended with '- Round X'.

Returns:
The title of the next game.

getOptionHtml

String getOptionHtml(/*String*/ title,
                     /*String*/ value,
                     /*String*/ defaultValue)

Creates HTML for an <OPTION ...> element.

Parameters:
title - 
The visible title of the OPTION element.
value - 
The value of the OPTION element.
defaultValue - 
If the value parameter equals this parameter, this OPTION will be selected.
Returns:
The HTML for the OPTION element.

Example:

   var defaultValue=0; // This will be the initially selected option value.
   html+=this.getSelectHtml("MySelect",this.event("mySelectOnchange()"));
   html+=this.getOptionHtml(this.resource("MyOption1Title"),0,defaultValue);
   html+=this.getOptionHtml(this.resource("MyOption2Title"),1,defaultValue);
   html+="</select>"; //Note manual closing of the element!
See Also:
getSelectHtml, getTextHtml, getTextareaHtml, getCheckboxHtml, getRadioHtml, getButtonHtml, getHtmlButtonHtml, getVButtonHtml, getAnchorHtml

getPieType

Number getPieType()

Called when needing the new game type to pie a game. Internally finds the current game type in the first half of the array 'gameTypes' in the resourcePack, and returns the type in the same position in the second half of the array. Override to alter.

Returns:
The new game type.

getPieceRect

Rectangle getPieceRect(/*String*/ value,
                       /*Number*/ color,
                       /*Point*/ boardPoint)

Gets the clipping rectangle for a piece.

Parameters:
value - 
The value of the piece.
color - 
(Optional) The color of the piece. Not used by default.
boardPoint - 
(Optional) The board point of the piece. Not used by default.
Returns:
The clipping rectangle.

getPieceSrc

String getPieceSrc()

Gets the fully qualified path for the piece image.

Returns:
The piece image path.

getRadioHtml

String getRadioHtml(/*Boolean*/ checked,
                    /*String*/ id,
                    /*Number*/ index,
                    /*String*/ eventCode,
                    /*String*/ attributes)

Creates HTML for a <INPUT TYPE=RADIO ...> element.

Parameters:
checked - 
The initial state of the element.
id - 
The class-local id of the element.
index - 
The index of the radio button in its group.
eventCode - 
(Optional) The code to execute on the onclick event of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the INPUT element.

Example:

   html+=this.getRadioHtml(true,"MyRadio",1,this.event("myRadioOnclick(1)"));
   html+=this.getRadioHtml(true,"MyRadio",2,this.event("myRadioOnclick(2)"));
See Also:
getCheckboxHtml, getButtonHtml, getHtmlButtonHtml, getVButtonHtml, getAnchorHtml, getSelectHtml, getOptionHtml, getTextHtml, getTextareaHtml, GamesByEmail.Game.getRadioHtml

getSelectHtml

String getSelectHtml(/*String*/ id,
                     /*String*/ eventCode,
                     /*String*/ attributes)

Creates HTML for a <SELECT ...> element.

Parameters:
id - 
The class-local id of the element.
eventCode - 
The code to execute on the onchange event of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the opening of the SELECT element.
Notes:
No options or closing </SELECT> tag is included, just the opening tag. The options and closing tag must be added manually to whatever HTML string is being built.

Example:

   var defaultValue=0; // This will be the initially selected option value.
   html+=this.getSelectHtml("MySelect",this.event("mySelectOnchange()"));
   html+=this.getOptionHtml(this.resource("MyOption1Title"),0,defaultValue);
   html+=this.getOptionHtml(this.resource("MyOption2Title"),1,defaultValue);
   html+="</select>"; //Note manual closing of the element!
See Also:
getOptionHtml, getTextHtml, getTextareaHtml, getCheckboxHtml, getRadioHtml, getButtonHtml, getHtmlButtonHtml, getVButtonHtml, getAnchorHtml

getSpectatorAnchorHtml

String getSpectatorAnchorHtml()

Creates HTML for a Spectator anchor.

Returns:
HTML for the anchor.

getSpectatorUrl

String getSpectatorUrl()

Gets the URL for spectating this game.

Returns:
URL.

getTeamAtDistance

Team getTeamAtDistance(/*Number*/ distance)

Gets the team that is a set number of places away in the parent teams colection, wrapping if necessary.

Parameters:
distance - 
The number of indices away to look. For example, 1 gets the next team in line.
Returns:
The team at the distance.

getTeamFontColor

String getTeamFontColor(/*Team*/ team)

Gets the team display color, such as #ff0000.

Parameters:
team - 
The team to get the color for.
Returns:
The color.

getTeamLogFontBgColor

String getTeamLogFontBgColor(/*Team*/ team)

Gets the team background-color for the game log, such as #ff8888.

Parameters:
team - 
The team to get the color for.
Returns:
The log background color.

getTeamLogFontColor

String getTeamLogFontColor(/*Team*/ team)

Gets the team display color for the game log, such as #ff0000.

Parameters:
team - 
The team to get the color for.
Returns:
The log color.

getTeamTitleAlignment

String getTeamTitleAlignment(/*Team*/ team,
                             /*Boolean*/ top,
                             /*Number*/ index,
                             /*Number*/ numTeams)

Gets the alignment for a team title. Defaults to "center".

Parameters:
team - 
The team.
top - 
If the title is above the board.
index - 
The position of the team in the list on that side of the board.
numTeams - 
The number of team titles on that side of the board.
Returns:
A horizontal alignment value, "left", "center" or "right".

getTeamTitleHtml

String getTeamTitleHtml(/*Team*/ team,
                        /*Boolean*/ top)

Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.

Parameters:
team - 
The team to get the color for.
top - 
Whether this team's title will be displayed above the board or below.
Returns:
The log background color.

getTeamTitlesHtml

String getTeamTitlesHtml(/*Boolean*/ top)

Gets the HTML for the team titles on the board.

Parameters:
top - 
Whether this teams' titles will be displayed above the board or below.
Returns:
The titles for all teams across the top or bottom.

getTeamsForTitles

Array getTeamsForTitles(/*Boolean*/ top)

Gets an array of teams to display either across the top or bottom of the board. Override to alter default behavior.

Parameters:
top - 
Will be true if getting teams for the top, else false for the bottom.
Returns:
The array of teams.

getTextHtml

String getTextHtml(/*String*/ value,
                   /*String*/ id,
                   /*String*/ attributes)

Creates HTML for a <INPUT TYPE=TEXT ...> element.

Parameters:
value - 
The initial value of the element, or null for blank.
id - 
The class-local id of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the INPUT element.

Example:

   // First
   html+=this.getTextHtml("Some value","MyText");
 
   //Then later..
   var value=this.getElement("MyText").value;
See Also:
getTextareaHtml, getCheckboxHtml, getRadioHtml, getSelectHtml, getOptionHtml, getButtonHtml, getHtmlButtonHtml, getVButtonHtml, getAnchorHtml

getTextareaHtml

String getTextareaHtml(/*String*/ id,
                       /*String*/ attributes)

Creates HTML for a <TEXTAREA ...> element.

Parameters:
id - 
The class-local id of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
Returns:
The HTML for the opening of the TEXTAREA element.
Notes:
No value or closing </TEXTAREA> tag is included, just the opening tag. The value and closing tag must be added manually to whatever HTML string is being built.

Example:

   // First
   html+=this.getTextareaHtml("MyTextArea");
   html+="Here is the value";
   html+="</textarea>"; //Note manual closing of the element!
 
   //Then later..
   var value=this.getElement("MyTextArea").value;
See Also:
getTextHtml, getCheckboxHtml, getRadioHtml, getSelectHtml, getOptionHtml, getButtonHtml, getHtmlButtonHtml, getVButtonHtml, getAnchorHtml

getTurnHtml

String getTurnHtml()

Called when needing the it-is-your-turn game prompts HTML. Override to set. Internally returns either beginTurnHtml, continueTurnHtml or completeTurnHtml.

Returns:
HTML for the game prompts.

getTurnTeam

Team getTurnTeam()

Finds the first team whose turn it is.

Returns:
The team whose turn it is.

getVButtonHtml

String getVButtonHtml(/*String*/ title,
                      /*String*/ id,
                      /*String*/ eventCode,
                      /*String*/ attributes,
                      /*String*/ styles)

Creates HTML for a vertical button, based on an <BUTTON ...> element.

Parameters:
title - 
The button's title, which will appear vertically in the center of the button.
id - 
(Optional) The class-local id of the element.
eventCode - 
(Optional) The code to execute on the onclick event of the element.
attributes - 
(Optional) Additional HTML attributes of the element if desired.
styles - 
(Optional) Additional CSS style settings for the element if desired.
Returns:
The HTML for the BUTTON element.

Example:

   html+=this.getVButtonHtml(this.resource("MyButtonTitle"),"MyButton",this.event("myButtonOnclick()"));
See Also:
getButtonHtml, getHtmlButtonHtml, getAnchorHtml, getSelectHtml, getOptionHtml, getCheckboxHtml, getRadioHtml, getTextHtml, getTextareaHtml

handleMoveCollision

void handleMoveCollision(/*Object*/ gameData,
                         /*Array*/ collisionMoves)

Override to handle move collisions from concurrent turns.

Parameters:
gameData - 
The most current gameData on the server. This is the state the collision moves must be merged into.
collisionMoves - 
The list of moves that generated the collision.

Example:

handleMoveCollision:function(gameData,collisionMoves)
{
   var lastCollisionMove=collisionMoves[collisionMoves.length-1];
   this.importRawGame(gameData);
   
   //make same moves as lastCollisionMove
   
   this.sendMove();
}

hiliteImageHtml

String hiliteImageHtml(/*Point*/ boardPoint,
                       /*Rectangle*/ clipRect)

Creates HTML for a highlight image.

Parameters:
boardPoint - 
The board point to center the highlight over.
clipRect - 
The clipping rectangle of the highlight image.
Returns:
The image HTML.
See Also:
clearHilites

initialize

void initialize(/*Number*/ numPlayers,
                /*Number*/ turnTeamIndex)

The first method to be called when a game is created, override to set up teams, players and the game state.

Parameters:
numPlayers - 
The number of players from the game form.
turnTeamIndex - 
The index of the team to set the initial turn. Call the Super with -1 to set all teams turn.

Example:

// Override initialize
   initialize:function(numPlayers,turnTeamIndex)
   {
      // Call the Super.initialize to add default teams.
      Super.initialize(numPlayers,turnTeamIndex);
 
      // Initialize the board state.
      this.info["board"]="rnbqkbnrpppppppp                                PPPPPPPPRNBQKBNR";
      var team=this.teams[0];
      team.info["i_ep"]=-1;
      team.info["b_cs"]=true;
      team.info["b_cl"]=true;
      team=this.teams[1];
      team.info["i_ep"]=-1;
      team.info["b_cs"]=true;
      team.info["b_cl"]=true;
      
      // Log the start of game.
      this.move.log=this.logEntry(44);
   }

initializeNewGameForm

void initializeNewGameForm(/*GameForm*/ gameForm,
                           /*Array*/ userInfo)

Seeds the game form options with values from the current game.

Parameters:
gameForm - 
The game form to seed.
userInfo - 
An array of user information.

isBoardPointHidden

Point isBoardPointHidden(/*Point*/ boardPoint)

Returns whether the board point is hidden from the current player, for games like Dark Chess.

Parameters:
boardPoint - 
The board point.
Returns:
The board point.

isColorAtPoint

Number isColorAtPoint(/*Point*/ point,
                      /*String*/ board,
                      /*Number*/ color)

Checks if the color of the value of a board string at a point is a color.

Parameters:
point - 
The board point to check.
board - 
The board string (a representation of the board state as a string).
color - 
The color to check.
Returns:
The color of the board string value at the point.
See Also:
isColorAtXY, isValueColorAtPoint

isColorAtXY

Number isColorAtXY(/*Number*/ x,
                   /*Number*/ y,
                   /*String*/ board,
                   /*Number*/ color)

Checks if the color of the value of a board string at a coordinate is a color.

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).
color - 
The color to check.
Returns:
The color of the board string value at the coordinate.
See Also:
isColorAtPoint, isValueColorAtXY

isMyTurn

Boolean isMyTurn(/*Boolean*/ checkEverything)

Checks to see if it is the current player's turn.

Parameters:
checkEverything - 
(Optional) Check everything, the game status, the spectating mode, and log mode too.
Returns:
true if it is the current player's turn.

isPathClear

Boolean isPathClear(/*Point*/ toPoint,
                    /*Point*/ fromPoint,
                    /*String*/ board)

Checks to see if all blank values lie in between two points. The points must be separated in one of the 8 orthogonal or diagonal 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).
Returns:
If all are blank spaces on the path, excluding toPoint and fromPoint.
Notes:
fromPoint and toPoint must be separated in one of the 8 orthogonal or diagonal directions. Pieces on fromPoint or toPoint are not included.

isPointBoardClear

Boolean isPointBoardClear(/*Point*/ point,
                          /*String*/ board)

Checks to see if a board string is clear at an x,y coordinate.

Parameters:
point - 
The board point to check.
board - 
The board string (a representation of the board state as a string).
Returns:
true if the board string value is clear at the point.

isPointOnBoard

Boolean isPointOnBoard(/*Point*/ point)

Checks to see if a board point is on the board.

Parameters:
point - 
The board point to check.
Returns:
true if the point is on the board.

isValueColorAtPoint

Number isValueColorAtPoint(/*Point*/ point,
                           /*String*/ board,
                           /*String*/ value,
                           /*Number*/ color)

Checks if the color of the value of a board string at a point is a color.

Parameters:
point - 
The board point to check.
board - 
The board string (a representation of the board state as a string).
value - 
The value to check.
color - 
The color to check.
Returns:
The color of the board string value at the point.
See Also:
isValueColorAtXY, isColorAtPoint

isValueColorAtXY

Number isValueColorAtXY(/*Number*/ x,
                        /*Number*/ y,
                        /*String*/ board,
                        /*String*/ value,
                        /*Number*/ color)

Checks if the color of the value of a board string at a coordinate is a color.

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).
value - 
The value to check.
color - 
The color to check.
Returns:
The color of the board string value at the coordinate.
See Also:
isValueColorAtPoint, isColorAtXY

isXYBoardClear

Boolean isXYBoardClear(/*Number*/ x,
                       /*Number*/ y,
                       /*String*/ board)

Checks to see if a board string is clear at an x,y 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).
Returns:
true if the board string value is clear at the coordinate.

isXYOnBoard

Boolean isXYOnBoard(/*Number*/ x,
                    /*Number*/ y)

Checks to see if an x,y coordinate is on the board.

Parameters:
x - 
The x coordinate, in board point space.
y - 
The y coordinate, in board point space.
Returns:
true if the coordinate is on the board.

itsYourTurnHtml

String itsYourTurnHtml(/*String*/ resourceName)

Called when needing the it-is-your-turn game prompt HTML (typically a short sentence about the move). Override and set mouse events here. Internally uses the "itIsYourTurnToMove" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

maybePie

void maybePie()

Called when the Pie button is pressed, opening a confirmation box to proceed with the pie.


maybeResign

void maybeResign()

Called when the Resign button is pressed, opening a confirmation box to proceed with the resign.


movePiece

String movePiece(/*Point*/ toPoint,
                 /*Point*/ fromPoint,
                 /*String*/ board)

Moves a value in a board string to another point.

Parameters:
toPoint - 
The board point to set the value at.
fromPoint - 
The board point to get the value from and set blank.
board - 
The board string (a representation of the board state as a string).
Returns:
The modified board string.

nextTeam

Team nextTeam(/*Boolean*/ playing)

Finds the next team from the current player.

Parameters:
playing - 
Specifies that the team must be playing (not resigned, eliminated, or a non playing team).
Returns:
The next team or null.

notYourTurnHtml

String notYourTurnHtml(/*String*/ resourceName)

Called when needing the it-is-not-your-turn game prompt HTML (typically a short sentence with Send Reminder, Refresh Game and Close Window buttons Start Another Game button). Override to set. Internally uses the "notYourTurn" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

numInPath

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 8 orthogonal or diagonal 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).
Returns:
The number of non-blank spaces, excluding toPoint and fromPoint.
Notes:
fromPoint and toPoint must be separated in one of the 8 orthogonal or diagonal directions. Pieces on fromPoint or toPoint are not counted.

numTeamsPlaying

Number numTeamsPlaying()

Counts the number of teams still playing.

Returns:
The number of playing teams.

offerDrawCheckBoxHtml

String offerDrawCheckBoxHtml()

Creates HTML for an Offer Draw checkbox.

Returns:
HTML for the checkbox.

offerDrawHtml

String offerDrawHtml(/*String*/ resourceName)

Called when needing the offer-a-draw-with-this-move prompts HTML (typically a short sentence and a Offer A Draw checkbox). Override to set. Internally uses the "youMayOfferDraw" and "offerDrawWithThisMove" resources.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

openLogAnchorHtml

String openLogAnchorHtml()

Creates HTML for a Open Game Log anchor.

Returns:
HTML for the anchor.

openPlayerChatAnchorHtml

String openPlayerChatAnchorHtml(/*String*/ id,
                                /*String*/ attributes,
                                /*Number*/ chatId,
                                ...)

Creates HTML for a Open Chat anchor.

Parameters:
id - 
The element id for the anchor, or null.
attributes - 
Additional attributes the anchor, or null.
chatId - 
(Repeatable) Player chat ids to include in this chat.
Returns:
HTML for the anchor.

openPreferencesAnchorHtml

String openPreferencesAnchorHtml()

Creates HTML for a Open Prefereneces anchor.

Returns:
HTML for the anchor.

openRulesAnchorHtml

String openRulesAnchorHtml(/*Number*/ index)

Creates HTML for an Open Rules anchor.

Parameters:
index - 
(Optional) The rule index to initially show, defaults to 0.
Returns:
HTML for the anchor.

pie

void pie()

Pies the game. Clears mouse events and sends.


pieButtonHtml

String pieButtonHtml()

Creates HTML for a Pie button.

Returns:
HTML for the button.

pieHtml

String pieHtml(/*String*/ resourceName)

Called when needing the you-may-pie game prompt HTML (typically a short sentence about pieing and a Pie button). Override and set. Internally uses the "youMayPie" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

processSecureMove

Boolean processSecureMove(/*GamesByEmail*/ game)

Gets called when the sending moves, fir processing secure move data on the client. Override to process secure data.

Parameters:
game - 
The game object to process.
Returns:
false.

refreshGame

void refreshGame()

Gets the latest game data from the server, also checks to make sure the game script files are up-to-date.


refreshGameButtonHtml

String refreshGameButtonHtml()

Creates HTML for a Refresh Game button.

Returns:
HTML for the button.

reportProblemAnchorHtml

String reportProblemAnchorHtml()

Creates HTML for a Report Problem anchor.

Returns:
HTML for the anchor.

resign

void resign()

Resignes the current player. Clears mouse events, sets the player as resigned, and sends the move.


resignButtonHtml

String resignButtonHtml()

Creates HTML for a Resign button.

Returns:
HTML for the button.

resignHtml

String resignHtml(/*String*/ resourceName)

Called when needing the you-may-resign prompt HTML (typically a short sentence about resiging and a Resign button). Override to set. Internally uses the "youMayResign" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

resignedHeaderHtml

String resignedHeaderHtml(/*String*/ resourceName)

Called when needing the resigned header HTML. Override to set. Internally uses the "resignedHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

screenRectFromBoardPoint

Rectangle screenRectFromBoardPoint(/*Point*/ boardPoint)

Gets the screen rectangle from a board point.

Parameters:
boardPoint - 
The board point to get the screen rectangle of.
Returns:
The screen rectangle.

screenRectFromBoardXY

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.
Returns:
The screen rectangle.

sendMove

Boolean sendMove(/*Boolean*/ sendNow,
                 /*Player*/ player)

Gets called when the Send Move button is pushed. Override and set the game state, then call Super.sendMove.

Parameters:
sendNow - 
(Optional) Send the moves to the server now. Else, save the move for sending later. Defaults to true.
player - 
(Optional) The player responsible for the move. Defaults to the current player (game.player).
Returns:
true.

sendMoveButtonHtml

String sendMoveButtonHtml()

Creates HTML for a Send This Move button.

Returns:
HTML for the button.

sendMoveHtml

String sendMoveHtml(/*String*/ resourceName)

Called when needing the send-this-move prompts HTML (typically a short sentence and a Send This Move button). Override to set. Internally uses the "youMaySendYourMove" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

sendReminderButtonHtml

String sendReminderButtonHtml()

Creates HTML for a Send Reminder button.

Returns:
HTML for the button.

setConstrainer

void setConstrainer()

Sets the constrainer property.


setEnded

void setEnded(/*Team*/ winningTeam)

Sets the game as ended.

Parameters:
winningTeam - 
(Optional) The team to mark as the winner, or null.

setFloatHtml

void setFloatHtml(/*String*/ html,
                  /*Number*/ width,
                  /*Number*/ height)

Shows HTML in a simple box centered over the board. Board mouse messages are suspended while box is shown.

Parameters:
html - 
The html to show in the box. Pass no parameters, null or empty string to hide the box.
width - 
The width the box. If width>1, is the width of the box in pixels. If 0
height - 
The height the box. If height>1, is the height of the box in pixels. If 0

setInnerHtml

void setInnerHtml(/*Element|String*/ element)

Sets the inner HTML of an element.

Parameters:
element - 
The element (either an Element or an ID of the element) to set the inner HTML of.
Notes:
The HTML may be altered to set a consistent style for the game based on user preferences.

setMouseHtml

void setMouseHtml(/*String*/ html,
                  /*Number*/ width,
                  /*Number*/ height)

Shows HTML in a simple box that follows the mouse around. The user will not be able to click on this box, it is for showing information only.

Parameters:
html - 
The html to show in the box. Pass no parameters, null or empty string to hide the box.
width - 
The width the box. If width>1, is the width of the box in pixels. If 0
height - 
The height the box. If height>1, is the height of the box in pixels. If 0

setPerspective

void setPerspective(/*Team*/ team)

Called when synchronizing, sets the perspective of the board based on the player. By default sets the rotation property to 0.

Parameters:
team - 
The team to synchronize.

setPlayerPrefs

void setPlayerPrefs()

Extract the player's preferences from the player.info collection, and sets properties accordingly. By default, the font and verbose properties are extracted.


setValueAtPoint

String setValueAtPoint(/*Point*/ point,
                       /*String*/ board,
                       /*String*/ value)

Sets a board string at a board point to a value.

Parameters:
point - 
The board point to set at.
board - 
The board string (a representation of the board state as a string).
value - 
The board value.
Returns:
The modified board string.

setValueAtXY

String setValueAtXY(/*Number*/ x,
                    /*Number*/ y,
                    /*String*/ board,
                    /*String*/ value)

Sets a board string at a coordinate to a value.

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).
value - 
The board value.
Returns:
The modified board string.

showTransactionPrompt

void showTransactionPrompt(/*String*/ resourceName)

Shows the a tranaction message (Sending Move, Initializing, etc.).

Parameters:
resourceName - 
The resource to display.

spectatingHtml

String spectatingHtml()

Called when needing the you-are-spectating game prompts HTML. Override to set. Internally returns the following combined: refreshGameButtonHtml and closeWindowButtonHtml.

Returns:
HTML for the game prompts.

startAnotherGameButtonHtml

String startAnotherGameButtonHtml()

Creates HTML for a Start Another Game button.

Returns:
HTML for the button.

startAnotherGameHtml

String startAnotherGameHtml(/*String*/ resourceName)

Called when needing the start-another-game prompt HTML (typically a short sentence with a Start Another Game button). Override to set. Internally uses the "youMayStartAnotherGame" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

synch

void synch()

Called when the game should synchronize with info properties from the server.

Notes:
The game should set tangible properties or states for each custom property set in the info collection. The info collection should not be referenced outside the scope of the synch or sendMove methods.

synchTeam

void synchTeam(/*Team*/ team)

Called to synchronize the team properties with the raw team data. Just the color and title properties are set by default, override to set more.

Parameters:
team - 
The team to synchronize.

teamColorFromTeam

Number teamColorFromTeam(/*Team*/ team)

Gets the team color.

Parameters:
team - 
The team to get the color of.
Returns:
The team color.

theyResignedHtml

String theyResignedHtml(/*String*/ resourceName)

Called when needing the they-resigned game prompts HTML. Override to set. Internally uses the "theyResigned" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

tieGameHeaderHtml

String tieGameHeaderHtml(/*String*/ resourceName)

Called when needing the tie-game header HTML. Override to set. Internally uses the "tieGameHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

titleFromTeamColor

String titleFromTeamColor(/*Number*/ color)

Gets the team title from a color.

Parameters:
color - 
The color to get the title for.
Returns:
The team title.

transformHashLinksToOnClicks

transformHashLinksToOnClicks(html)
Parameters:
html - 


turnHeaderHtml

String turnHeaderHtml(/*String*/ resourceName)

Called when needing the it's-your-turn header HTML. Override to set. Internally uses the "turnHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

undo

void undo(/*Boolean*/ skipUpdate)

Undos all moves since the last synch method call. The synch and update methods will be called again.

Parameters:
skipUpdate - 
(Optional) Skips the update call if true. Defaults to false.

undoButtonHtml

String undoButtonHtml(/*String*/ resourceName)

Creates HTML for a Undo button.

Parameters:
resourceName - 
(Optional) Name of resource to use for button title. Defaults to 'Undo'.
Returns:
HTML for the button.

undoMoveHtml

String undoMoveHtml(/*String*/ resourceName)

Called when needing the undo-this-move prompts HTML (typically a short sentence and an Undo button). Override to set. Internally uses the "youMayUndoYourMove" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the game prompts.

update

void update()

Updates the team titles, the game header, the game title, all prompts and action links.


updateTeamTitles

void updateTeamTitles()

Updates the top and bottom team title rows.


valueFromBoardValue

String valueFromBoardValue(/*String*/ boardValue)

Gets the value from a board value. By default, the lower case of the board value is returned.

Parameters:
boardValue - 
The value to check, by default a single character.
Returns:
The value.

valueFromPointBoard

String valueFromPointBoard(/*Point*/ point,
                           /*String*/ board)

Gets the board value at a board point.

Parameters:
point - 
The board point to get the value of.
board - 
The board string (a representation of the board state as a string).
Returns:
The value at the point.

valueFromXYBoard

String valueFromXYBoard(/*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).
Returns:
The value at the coordinate.

valueIndexFromBoardPoint

Number valueIndexFromBoardPoint(/*Point*/ point)

Gets the board string index of a point.

Parameters:
point - 
The board point to get the index of.
Returns:
The index of the board point.

valueIndexFromBoardXY

Number valueIndexFromBoardXY(/*Number*/ x,
                             /*Number*/ y)

Gets the board string index of a coordinate.

Parameters:
x - 
The x coordinate, in board point space.
y - 
The y coordinate, in board point space.
Returns:
The index of the coordinate.

wonHeaderHtml

String wonHeaderHtml(/*String*/ resourceName)

Called when needing the won-game header HTML. Override to set. Internally uses the "wonHeader" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

youLoseHtml

String youLoseHtml(/*String*/ resourceName)

Called when needing the you-lose game prompts HTML. Override to set. Internally uses the "youLose" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

youResignedHtml

String youResignedHtml(/*String*/ resourceName)

Called when needing the you-resigned game prompts HTML. Override to set. Internally uses the "youResigned" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

youTiedHtml

String youTiedHtml(/*String*/ resourceName)

Called when needing the you-tied game prompts HTML. Override to set. Internally uses the "youTie" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.

youWinHtml

String youWinHtml(/*String*/ resourceName)

Called when needing the you-win game prompts HTML. Override to set. Internally uses the "youWin" resource.

Parameters:
resourceName - 
(Optional) A resource name to override the default resource to use.
Returns:
HTML for the header.