Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
initial public commit
Browse files Browse the repository at this point in the history
a
  • Loading branch information
chadselph committed Nov 2, 2012
1 parent 618a545 commit 7e34e60
Show file tree
Hide file tree
Showing 17 changed files with 1,699 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.eunit
deps
priv
*.o
*.beam
*.plt
*.plt
43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
chessms
=======
ChesSMS is an application that lets you play Chess over SMS, powered by
[Twilio](http://www.twilio.com/).

Play Chess over SMS!

## Dependencies
Erlang/OTP R15B01 (may work on older versions)

## Building

ChesSMS uses [rebar](https://github.com/basho/rebar). To build it...

./rebar get-deps
./rebar compile

## Choosing a Chess Engine
ChesSMS should in theory work with any UCI compatible chess engine. It is known to
work with [Stockfish](https://github.com/mcostalba/Stockfish).

If using stockfish, compile it according to your machine and copy the
binary to `priv/bin/stockfish`.

If using another Chess Engine, you can put the binary where ever you want
but you'll have to modify `src/chessms_server.app.src` and change the
`engine_path` configuration parameter.

## Running
If everything has been built correctly, you should be able to run:

erl -pa ebin deps/*/ebin -s chessms_server -chessms_server port 7000

## Connecting to SMS
To connect ChesSMS to an SMS enabled Twilio number, sign up for Twilio
and buy a number (if you haven't already). Configure the SMS URL of the
phone number to point where your ChesSMS server is running.

Now, you should be able to text "play" to your Twilio phone number to
start a chess game!

## Contributing
Contributions are welcome. If you're looking for things to add, checkout
the Issues page.
15 changes: 15 additions & 0 deletions ebin/chessms_server.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{application,chessms_server,
[{description,"HTTP Server for ChesSMS"},
{vsn,"0.0.1"},
{modules,
[chessboard,chessms_engine_pool,chessms_game,chessms_game_sup,
chessms_handler,chessms_server,chessms_server_sup,chessms_store,
uci_worker]},
{registered,[chessms_server]},
{applications,[kernel,stdlib,xmerl,cowboy]},
{mod,{chessms_server,[]}},
{env,
[{pools,
[{engine_pool,
[{size,5},{max_overflow,15}],
[{engine_path,"priv/bin/stockfish-linux"}]}]}]}]}.
33 changes: 33 additions & 0 deletions include/chessboard.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
% move these records to an hrl file later

-type chesspiece() :: pawn | bishop | knight | rook | queen | king.
-type chesscolor() :: white | black.
-type chessmove_special() :: normal | castle | promotion | enpassant.
-type chesssquare() :: 1..64.

-define(STARTPOS_FEN, "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1").

-record(castling_rights, {
white_kingside = true :: boolean(),
white_queenside = true :: boolean(),
black_kingside = true :: boolean(),
black_queenside = true :: boolean()
}).

-record(chessboard, {
placements :: tuple(),
active = white :: chesscolor(),
castling = #castling_rights{} :: tuple(),
enpassant = none :: chesssquare() | none,
halfmove_clock = 0 :: pos_integer(),
fullmove_number = 1 :: pos_integer()
}).
-record(chessmove, {
side :: chesscolor(),
chesspiece :: chesspiece(),
from :: chesssquare(),
to :: chesssquare(),
special :: chessmove_special(),
capture = false :: boolean(),
promotion = undefined :: chesspiece() | undefined
}).
1 change: 1 addition & 0 deletions priv/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ChesSMS
Binary file added rebar
Binary file not shown.
8 changes: 8 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%%-*- mode: erlang -*-
{deps, [
{cowboy, ".*", {git, "git://github.com/extend/cowboy.git", "5525369a4a98ff57f157842106f4adbbe1514d1b"}},
{poolboy, ".*", {git, "git://github.com/devinus/poolboy.git", "fc8312d0f77bb16557030b65803fe81320e51c78"}},
{mimetypes, ".*", {git, "git://github.com/spawngrid/mimetypes.git", "0.9"}}
]}.
{sub_dirs, ["rel"]}.
{cover_enabled, true}.
Loading

0 comments on commit 7e34e60

Please sign in to comment.