Skip to content

Latest commit

 

History

History
146 lines (90 loc) · 4.11 KB

README.md

File metadata and controls

146 lines (90 loc) · 4.11 KB

TigerZone

The Team

Team Q

James Steele

https://github.com/Zubry

Austin Seber

https://github.com/aseber

Ricky Tran

https://github.com/rickydtran

Jay Wang

https://github.com/jw6

Patrick Bradley

https://github.com/bradley734

Daniel Williams

https://github.com/williamsd4808

Project structure

We decided to use client-server architecture, writing the gen server in Java, a GUI client written in javascript with Electron, a TCP adapter written in Node.js, and an AI also written in Node.js. Directories of interest in this project are electron-client, server, tcp-adapter, and random-ai.

The idea is that each client (the Electron client and the AI) makes requests to the server, which maintains the game state. This allows us to easily synchronize state between clients (i.e. it's easy for a human to play against the AI and for AIs to play against each other) and allows us to write clients without knowing the details of the game (i.e. we request a list of valid placements of a certain tile instead of calculating them using the rules of TigerZone).

This project should be runnable on Ubuntu 14.04 with node v6.3.1 and OpenJDK 8. There are no guarantees that any other system will work with other configurations, especially those running on Windows.

Electron client

To run the Electron client, make sure that you have node installed:

TigerZone$ node -v
v6.3.1

If you get a response saying that node isn't installed, go install it.

Next, install electron-prebuilt globally

TigerZone$ npm install -g electron-prebuilt

You should be able to run the Electron client now without any issues since all dependencies are packaged with it.

Tigerzone$ electron electron-client

Now, you can create, join, and load games from the datastore. Remember to scroll down about halfway to view the game board. The client will update every time the datastore updates and automatically display valid moves. You can place and rotate tiles.

Java Gen (Generic) Server

Compilation

In order to compile the gen server, switch to the server/ApiEndpoints directory and run the build script, i.e.

TigerZone$ cd server/ApiEndpoints
ApiEndpoints$ bash build.sh
ApiEndpoints$ cd ../../

Endpoints

We expose 4 endpoints in order to interact with the gen server. As Java can be a little verbose, we provide bash scripts for each endpoint for your convenience.

new-game

TigerZone$ bash server/ApiEndpoints/new-game game_id

join-game

TigerZone$ bash server/ApiEndpoints/join-game game_id player_id

get-moves

TigerZone$ bash server/ApiEndpoints/get-moves game_id

place-tile

TigerZone$ bash server/ApiEndpoints/place-tile game_id tile_id x y orientation

watch-game

Watch game allows clients to observe the game, and is written in Node.

TigerZone$ ./server/ApiEndpoints/watch-game game_id

TCP adapter

To run the adapter, just run

TigerZone$ node main ip port tournament_password user password

We provide a test server, which runs on 127.0.0.1:9000. To use it, just send the server responses to stdin and it will echo them to the client.

TigerZone$ node tcp-adapter/test-server

To prove that the adapter works, we typically just pipe examples from the protocol to the test server. Timestamps are also included for perf purposes.

Testing

Performance tests

TigerZone$ node perf

Node TCP Adapter tests

This will print an example challenge that has been parsed. Any errors will get thrown, so a successful test has none.

TigerZone$ node tcp-adapter/test

Meeples/Tigers

We scale up to a 5x5 subgrid in order to solve the problem of jungles being errantly separated from each other by a lake. We also introduce a "hole" subtile that acts as a blocker for the flood fill, allowing us to have us to have 2 jungles and 2 lakes instead of 1 jungle and 2 lakes or 2 jungles and 1 lake in the example below.

We also have to select 9 subtiles to act as our tiger tiles, and we chose those below. Demo pic