0.0
No commit activity in last 3 years
No release in over 3 years
Codebreaker is a logic game in which a code-breaker tries to break a secret code created by a code-maker. The code-maker, which will be played by the application we’re going to write, creates a secret code of four numbers between 1 and 6.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

DkCodebreaker

Gem Version Build Status

Codebreaker is a logic game in which a code-breaker tries to break a secret code created by a code-maker.The code-maker, which will be played by the application we’re going to write, creates a secret code of four numbers between 1 and 6.

Installation

Add this line to your application's Gemfile:

gem 'dk_codebreaker'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dk_codebreaker

Quick documentation

# create game instance, it get user name and attempts
game = DkCodebreaker::Game.new(name,attempts)

# mandatory run, this will generate secret code
game.start

# set attempts score to nil and regenerate it
game.restart

# enter user answer as string
# Return [position_number String]
# Win if you get "++++" here 
# Error codes:
### :less_then_four
### :guess_has_symbol
### :code_not_string
### :you_lose
game.guess user_code

# return [hint String] 
game.hint

# Return Hash with user data {player,result,attempt,attempts,time}
# :player   - username
# :result   - last game result
# :attempt  - current attempt number
# :attempts - limitation of trying
# :time     - "%m/%d/%Y/%H/%M"
game.user_data

# Getters and Setters 
game.hint_status
game.attempt
game.player
game.player=
game.attempts
game.attempts=

Implementations

codebreaker_console

codebreaker_web

Contributing

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

License

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