4 KiB
Node Go
A browser application to play Go in real time.
The project in it's current state
Client only prototype
About Go
Technical Challenges
Setup For Development
Known Bugs
Roadmap
Features
Tech
The Game of Go
Go is a 2 player abstract strategy game of perfect information.
Players take turns placing playing pieces called stones on the intersections of a gridded board. This board is usually a square 19 points across. Stones remain on the points at which they are placed unless they are captured by the opposing player. Capture occurs when a stone or group of stones no longer has any adjascent empty points.
Play ends when both players agree that they have exhausted all advantageous moves. Scoring is determined by counting and comparing the area controlled by either player.
For a more detailed explanation of the rules, please see my previous illustrated explanation of the game of go or the American Go Association's Concise Rules of Go.
Technical Challenges
Modeling Game State
A go board typically consists of 361 points which can exist in a number of states.
Partitioning Game Rooms
Finding a game starts with joining a game room. Watch an in progress game, join a game, or study a historic game.
Setup
Local Repo
$ git clone https://github.com/sorrelbri/node-go.git
Install Deps
$ npm run bootstrap
Runs lerna bootstrap
command installing dependencies for project, development and package dependencies
Initialize Database
Download PostgreSQL
To verify PostgreSQL installation:
$ psql -V
Node Go API was built with version 11.4. See documentation for Postgres download.
Create Databases
$ psql
# psql(11.4)
CREATE DATABASE node-go;
CREATE DATABASE node-go-test; # testing database
Configure Environment
$ touch packages/server/.env
# .env
NODE_ENV=development
PORT=# set development port for API
REACT_ADDRESS=http://localhost:3000 # default
PG_CONNECTION_STRING=postgresql://localhost:5432/node-go
PG_CONNECTION_STRING_TEST=postgresql://localhost:5432/node-go-test
JWT_SECRET=# generate a secret key for JWT signing algorithm
TEST_SECRET=# same as above, for test environment
SALT_ROUNDS=# set number of salt rounds for bcrypt hashing function
DOMAIN=localhost
USER_ONE_PASSWORD=# credentials for testing with
USER_ONE_EMAIL=# same as above
Smoke test
$ lerna run test
Run Database Migrations
$ cd packages/server; npm run migrate; npm run seed
Running in development
$ cd packages/server
$ npm start # or if you have nodemon
$ nodemon
$ cd packages/play-node-go
$ npm start
Known Bugs
- game end logic not implemented on front end yet
- no authorization for game moves
- websocket connections may remain open, pooling prevents runaway leaks, but tests may hang
Roadmap
6/20
- Frontend implementation of game end logic
- Auth for games
- Game request creation
7/20
- Generate game records
- Implement chat
- Implement study mode
Features
- Realtime play
- Account authentication
- Chat
- Study mode
- Multiple game settings
- Customizable board size
- Download games in .sgf format
Built with
Management & Deployment
- Lerna
- CircleCI