https://github.com/micrum/knight-move
Simple and addictive game
https://github.com/micrum/knight-move
Last synced: 3 months ago
JSON representation
Simple and addictive game
- Host: GitHub
- URL: https://github.com/micrum/knight-move
- Owner: micrum
- Created: 2015-11-06T20:50:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-24T18:50:08.000Z (over 10 years ago)
- Last Synced: 2025-03-23T03:16:23.979Z (over 1 year ago)
- Language: Ruby
- Homepage: http://knightmove.r15.railsrumble.com/
- Size: 1.31 MB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Getting started
We use rails-dotenv so you need to create
```
.env.test
.env.development
```
with variables
```
POSTGRESQL_HOST=#{your_hostname} # localhost usually
POSTGRESQL_USERNAME=#{your_username}
POSTGRESQL_PASSWORD=#{your_password}
```
To run migrations use: rake db:migrate:reset
To run migrations on production use:
```
heroku pg:reset DATABASE_URL --confirm tranquil-bayou-6575
heroku run rake db:migrate
```
## API:
USER
To create a User: `POST http://localhost:3000/users?name=#{name}` - respond will contain uuid
To update User name: `PUT http://localhost:3000/users?uuid=#{uuid}&name=#{name}`
To get User name: `GET http://localhost:3000/users?uuid=#{uuid}`
GAME
To create a Game: `POST http://localhost:3000/games` - respond will contain uuid
To get game by uuid: `GET http://localhost:3000/games?game_uuid=#{uuid}`
To save game stats: `PUT http://localhost:3000/games?uuid=#{user_uuid}&game_uuid=#{uuid}&time=#{time}&steps=#{steps}`
To retrieve position of current game: `GET http://localhost:3000/position?game_uuid=#{uuid}`
To retrieve scoreboard(top20 games): `GET http://localhost:3000/scoreboard`