m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/curling.rb
blob: 1367b02ee348e3194c4fdd9979adf605ea9662e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'sinatra'
require 'sinatra/cookies'

require './hex_engine'

def secret
  ENV['HEX_SECRET'] || 'tajny_token_hehe'
end

get '/:command' do |command|
  engine = Hex.new cookies.to_h
  engine.step command
  engine.state_h.each_pair do |key, value|
    cookies[key] = value
  end
  engine.message
end