Skip to content

Karoid/rock_scissors_paper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

RockScissorsPaper

This is gem that creates rock,scissor,papper page in your webpage you need devise gem, and user model!

Installation

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:

$ bundle

then make database for rock_scissor_papper!

$ rails g rock_scissors_paper MODEL

this will make migration file for the game points

$ rake db:migrate

then you can do your game in route "/game/rsp"

Customization

์„ค์ •์„ ๋ฐ”๊พธ๊ณ  ์‹ถ์œผ์‹œ๋‹ค๋ฉด ์œ„์˜ ๋ช…๋ น์–ด๋ฅผ ์ณ์„œ ๋งŒ๋“  /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

์กฐ๋งŒ๊ฐ„ ์ ์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฉ”์†Œ๋“œ์™€ ์ฐจ๊ฐํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

Usage

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 point

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Karoid/rock_scissors_paper.

License

The gem is available as open source under the terms of the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors