This is gem that creates rock,scissor,papper page in your webpage you need devise gem, and user model!
This gem is dependent to devise gem. If you don't, please install it. Add this line to your application's Gemfile:
gem 'rock_scissors_paper', :git => 'https://github.com/Karoid/rock_scissors_paper'And then execute:
$ bundlethen make database for rock_scissor_papper!
$ rails g rock_scissors_paper MODELthis will make migration file for the game points
$ rake db:migratethen you can do your game in route "/game/rsp"
์ค์ ์ ๋ฐ๊พธ๊ณ ์ถ์ผ์๋ค๋ฉด ์์ ๋ช ๋ น์ด๋ฅผ ์ณ์ ๋ง๋ /config/initializers/rock_scissors_paper.rb ํ์ผ์ ์ค์ ์ ์์ ํ์๋ฉด ๋ฉ๋๋ค.
RockScissorsPaper.setup do |config|
#Devise ์ผ์ผ๋ก ๋ง๋ ๋ชจ๋ธ์ ์ด๋ฆ์ ๋ฃ์ต๋๋ค
config.user_model_name = "user"
#๋ผ์ฐํธ๋ฅผ ์๋์ผ๋ก ์ฌ์ฉํ๊ณ ์ถ์ผ๋ฉด ์ฃผ์์ ํธ์ธ์
#config.automatic_routes_mount = false
#๊ธฐ์กด์ application layout์ ์ฌ์ฉํ๊ณ ์ถ์ผ์๋ค๋ฉด ์ฃผ์์ ํธ์ธ์
#config.use_layout = true
#์ฌ๊ธฐ๋ ๊ฑด๋ค ์ผ์ด ๊ฑฐ์ ์์๊ฒ๋๋ค. ์์ฑํ ๋ชจ๋ธ ํด๋์ค๋ฅผ ์ค์ ํด์ค๋๋ค.
config.default_model = Point
#๊ณต์ง์ฌํญ์ด ์์ผ๋ฉด ์ฌ๊ธฐ์ url ์ฃผ์๋ฅผ ์ ์ผ๋ฉด ๊ณต์ง ๋ณด๊ธฐ๋ผ๋ ๋งํฌ๊ฐ ์์ฑ๋ฉ๋๋ค
#config.notice_route = "/game/notice"
#์ฒ์ ๊ฒ์ํ๊ฒ ๋ ๋ ์ง๊ธํ ํฌ์ธํธ๋ฅผ ์ค์ ํฉ๋๋ค.
#config.initial_point = 5000
end์กฐ๋ง๊ฐ ์ ์๋ฅผ ์ถ๊ฐํ๋ ๋ฉ์๋์ ์ฐจ๊ฐํ๋ ๋ฉ์๋๋ฅผ ์ถ๊ฐํ ์์ ์ ๋๋ค.
Want to change points? Use these methods
change_points(points)
#=> change current user point as much as you put number (can put negetive number)
set_points(points)
#=> set current user point as much as you put number (cannot put negetive number)Want to check points? Use this
current_points #=> return current user pointBug reports and pull requests are welcome on GitHub at https://github.com/Karoid/rock_scissors_paper.
The gem is available as open source under the terms of the MIT License.