| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
This reverts commit 484082a034e6a6eafb2fef11039e96b1a7054725.
|
| | |
|
|\| |
|
| | |
|
|\| |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\ |
|
| | |
|
|/ |
|
|
|
|
|
| |
Instead of duplicating code for removing captured pieces, we can use a
general function that both removes pieces *and* updates the piece delta.
|
| |
|
|
|
|
| |
Too many changes to write a commit message, just read the code.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This will be important in order to calculate the `averageMoves' variable.
|
|
|
|
|
|
|
| |
The removed code has either been moved to other files such as the
`Piece' class, or has been upgraded elsewhere (such as the `start()'
function becoming the `boardInit()' function found in
`/draughts/game.js').
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The server now has an array of games that currently exist. When a
client attempts to join a game, the server will check if another
player is already waiting for an opponent and if so, matches the two
players against each other. If all the games are full the server will
create a new game and the player will need to wait for an opponent.
The server also has handling for clients that disconnect. When that
event occurs, the remaining client is sent a message informing them
that their opponent disconnected, and the game is deleted. None of the
statistics are updated as it wouldn't make sense to count a statistic
such as `minimumMoves' if the opponent disconnected only a few moves in.
|
|
|
|
|
|
|
|
| |
The game class contains the entire state of the game, its history, and
the websockets connected to both clients. The class also has a
`messageAll()' method which can be used to send a message to both of
the clients. The `boardInit()' function can be used to initialize a
brand new 10x10 draughts board.
|
|
|
|
|
|
|
|
| |
At the moment this script does not do much, it simply registers an
event listener to inform the server about when one of the clients
resigns the game which activates when someone clicks the "resign"
button. In the future this script will most likely house all the
client-side functionality related to the game.
|
|
|
|
|
|
|
|
| |
This enumeration contains all of the different Messages that can be
communicated between the clients and the server. The enum names should
make the meaning of each obvious enough, but they still have comments
besides them explaining who sends the message to who, and what the
message actually entails.
|
|
|
|
|
| |
This class represents a piece on a draughts board. Pretty obvious why
this would exist I think.
|
|
|
|
|
|
|
|
|
|
| |
The environment object holds basically all the information about the
state of all the games, statistics regarding games, etc.
The `minimumMoves` and `averageMoves` variables start out at infinity
just so that we have an easy way to check if they've actually been set
yet or not, since they won't be properly set before any games have
even been played.
|
|
|
|
|
|
|
| |
The previous version had a dark square as the upper left corner, but a
proper draughts board has a light square in the upper left, and we
don't want to look like monkeys that don't know the rules of the game
we're making.
|
|
|
|
| |
They are optional in javascript, so why waste screen space on them?
|
|
|
|
|
|
|
|
|
| |
This enumeration represents the two colors of the pieces on the board,
it should allow you to refer to a color as `Color.BLUE' or `Color.RED'
as opposed to having to use strings or random numbers or whatever. It
also means that if for whatever reason we decide to flip the positions
of blue and red or something similiar, it should be a very quick and
easy fix.
|
| |
|
| |
|