GithubHelp home page GithubHelp logo

o-jill / washcrus Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.42 MB

online shogi game service

License: The Unlicense

Ruby 72.82% JavaScript 21.10% CSS 2.68% HTML 3.05% Shell 0.34%
online-services shogi ruby cgi

washcrus's Introduction

license issues Code Climate Inline docs Firefox test Chrome test Firefox test Chrome test Rubocop Rspec

"WashCrus" will be online shogi match management system.

"WashCrus" was named for "洗足池" which is a pond in Tokyo.

"WashCrus" is written in Ruby.

Lisence:
Public domain

How to set up:

  1. Clone repo. or unzip WashCrus archive to certain path where is allowed to run CGI script.
  2. Edit ./config/mail.yaml.sample and save it as ./config/mail.yaml
  3. Edit ./config/signature.txt.sample and save it as ./config/signature.txt
  4. Run "bundle install --path vendor/bundle" to get required gems.
  5. Run "rake gen_token" to generate KEY to encrypt data.
  6. Run "bundle exec rake add_admin" to add first administrator.
  7. Run "rake init" to generate db file and change some files/directories's permissions.
  8. Visit index.rb by your browser.

ruby path:
please adjust ruby path to fit your actual ruby path.

Simple backup:
"rake backup" stores all the data into a tarball in backup directory.
you can use "backup.sh" after adjusting a path in the script and run it periodically, e.g. once a day.

Enable Time control:
"periodic_tasks.sh" controls byo-yomi.
you have to adjust a path in the script and period in minutes.

required "gem"s:

  • bundler
    • jkf(o-jill/jkf, kif_robust_time)
    • mail
    • rake
    • redcarpet
    • reek (for test)
    • rspec (for test)
    • rubocop (for test)
    • unindent

Enable pictures on SNS:
SNS such as twitter utilize Open Graph Protocol and shows a picture according to a URL in your tweet. this term is for that picture.
please adjust SVG2PNG in sfenimage.rb according to your converter.
supported SVG -> PNG converters:

  • Inkscape 0.92
  • Inkscape 1.*
  • rsvg-convert

Other dependends:

  • Kifu for JS(for replay)

washcrus's People

Contributors

nob-aoki avatar o-jill avatar

Stargazers

 avatar

Watchers

 avatar  avatar

washcrus's Issues

online help

for users, you have to prepare help documents to let them understand this system.

make cookie living longer

now, log-in status can continue only within a day.
i want to make it a week or a month.
it's troublesome for me to log-in everyday.

user id length

now id is digest::sha256.
but it is too long to load and to store.
moreover, you can use first xx letters as id like hash in git repo.
in git, they use SHA1 and first 7 letters are thought to be enough to distinguish commits.

sfen is not updated sometimes.

sfen is not updated by simple reloading (not super-reload) after an opponent moved.
but notation is updated.
so, to solve this mismatch, reloading if they does not match or strict reloading should be considered.
or is this phenomena only happens with chrome?!

secret key token

to make the KEY different, to encrypt user information such as e-mail address, KEY should be generated when you setup this software.

so, it is good timing to generate the KEY when you run "rake init".

ruby has SecureRandom module to generate random string. and redmine(rails?) uses it to generate secret_token.rb.
https://docs.ruby-lang.org/ja/latest/class/SecureRandom.html

finishing a game.

how to finish a game?

win or lose:

  • resign
    resign button should be added.
  • tsumi
    capturing king can be substituted.
  • time up
    now i don't care time up at all.

draw:

  • sennichite(repetetion)
    all SFENs should be stored to check.
  • jishogi
    counting point is needed.

others:

  • illegal move
    might not be happened (i hope).
  • error

each user's winning stats

add #s of wins and loses to user database.

the #s should be shown in your "my page".

SENTE and GOTE should be distinguished.

centering some tables

some tables area aligned left but the others are aligned center.
i think all of them should be aligned center.

Recognize TEBAN

Let a player move one of his pieces in his turn.
Updating TENBAN in realtime should be implemented for convenience.

add jsonmove "relative".

to distinguish pieces in standard kifus and ki2 files, relative information is added. e.x. "5二金左"

na2hiro/json-kifu-format/Readme.mdより

RelativeString = string 以下の文字列を連結したもの
左, 直, 右: それぞれL, C, R(Left, Center/Choku, Right)
上, 寄, 引: それぞれU, M, D(Up, Middle, Down)
打: H(Hit 何か違う気もする)

to add this information, you have to change

  • csamove format
    or
  • calc "relative" in server with csamove and sfen

shogi-ban UI

shogi-ban ui is the most important point in this system.

how will you build it, <canvas> or <table>?

if you want to use images for pieces, you also have to prepare them.

administration

some users can act as administrator and they can

  • fix some problem in a game.
  • generate a new game(?)
  • give a user a new password.
  • update a user's e-mail address.
  • and so on.

if you want some users becoming a administrator, you have to

  • add admin right term in user information db.
  • add administration page.

jkf -> csa does not work?

while converting to csa, dlkif.rb stops in jkf-0.4.2 gem.
is it my fault? is time needed?
or jkf has some bug? (maybe not)

game information file

game infomation should be stored in a file.

  • players
  • e-mail addresses
  • the position (sfen?)
  • latest move (can kihu substitute?)
  • when the latest move was performed
  • turn (sfen or kihu?)
  • status(playing or checkmate, resign, draw(ji-shogi)

new game generation

when a new game is generated, some information such as the opponent name, black/white, URL, and so on have to be announced by e-mail.

does playing information have to be recorded as user information?

games have to be indexed in some db.

some playing information files have to be generated, such as a score, game information and chat text.

if one of the players is already playing, it is not allowed that a new game is generated.

session-id management

session-id should not be changed to open several pages in parallel.
current session-id system is disappointing.
after changing, you have to log-in every 30 days. but i think it's acceptable.

KOMA pictures.

preparing koma pictures.

  • png
  • 32px x 32px? or 40px x 40px?
  • 2 letters? or 1 letter?

increment move index(N手目) in sfen

a sfen-text generated by javascript dose not care move index.
it doesn't matter if the number is not updated.
but it's good for debugging which you will do in the future:P

downloading a kifu file.

downloading a kifu file is one of the most important feature in this system.

by clicking some link or button in game screen close to KIFU area, downloading will be started.

2TEZASHI

u have to prevent moving twice in a turn.
checking n-th and TEBAN might be good.

add jsonmove "same".

to express same position movement, e.x. "同玉", a term, "same", is reserved.
to convert to kif and ki2 correctly, "same" term is important.

Handicap match

Handy-cap match is common.

  • Kaku-ochi
  • Hisha-ochi
  • 2 Mai-ochi
  • 4 Mai-ochi
  • and so on

add jsonmove "used time".

it is normal that used time for each move is written in a kifu.

to get used time, you have to calc time difference btw 2 moves.

date time at last move is in matchinfofile and you can get current date-time.
you can simply subtract them to calc the interval.

hp address in a mail

when a game is generated, mails are sent to both players.
but in the message, server address is "localhost".
so you have to make it easier to adjust actual server address.

how to notify the opponent's move.

http protocol does not support notifying feature.
so, you have to develop some alternative.

  • polling something by user's browser.
    • and update automatically.
    • but only tell you the opponent moved a piece. (you have to update your the page)
    • but only tell you the opponent moved a piece and show update button to reload.
  • send e-mail
  • say something to chat.

game finder

game search feature by user name.
i want to find my games at least.

now game db records only player names. so user IDs should be added to find easy and to make it robust.

TSUMI check

To implement TSUMI check, referring some software is the easiest way.

stopping accessing game.rb directly

to access a game you will access example.com/cgi-bin/game.rb?abcdefg.

but you can substitute it by accessing example.com/cgi-bin/washcrus.rb?game/abcdefg.

unfortunately, i do not know if i can apply it to chat.rb and move.rb, that uses ajax.

i hope it can fix session expiring problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.