codebreakergem 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/codebreakergem/version.rb +1 -1
- data/lib/locales/en.yml +0 -7
- metadata +2 -4
- data/datadata.yml +0 -1
- data/main.rb +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4037f592f943f162e0d39abbfabe74e5ba3e7a79019e4dfbd875601cb6310293
|
4
|
+
data.tar.gz: 671252a913e1d5a691dd0ecda6c374f611a6d496a60c19f611b7e3f00e7a544c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f690c6ae82685c759cd505675937d69738e3caa7fe4367fb748488dd906d3ce131bb8de4af73629c2d7fcf0e6b47110a21e386a9aad91f512f9d46659ef78090
|
7
|
+
data.tar.gz: af5513cf119e5acf09df2b4f7a6601e84fae9a8d66111dc74f336a39a5abe4dfc8323ca0d23c255cf2621798cc3c56e6ad33a1adf1fd6f5c7dfb4682c9f457de
|
data/lib/locales/en.yml
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
en:
|
2
|
-
class_error: 'Wrong type of variable'
|
3
2
|
length_error: 'Length of the string is not in allowed range'
|
4
3
|
no_hints: 'You have no more hints'
|
5
|
-
hello_message: 'Hello player! Welcome to codebreaker'
|
6
4
|
stats_header: "Rating Name Difficulty Attempts Total Attempts Used Hints Total Hints Used\n"
|
7
|
-
menu: "Chose action:\n
|
8
|
-
1) Start\n
|
9
|
-
2) Rules\n
|
10
|
-
3) Stats\n
|
11
|
-
4) Exit\n"
|
12
5
|
victory_message: 'Congratulations!!! YOU WON!!!'
|
13
6
|
out_of_attempts: 'Unfortunately you have no more attempts'
|
14
7
|
rules: " ____________________________________________________________________________________________\n
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebreakergem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sasha
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,7 +74,6 @@ files:
|
|
74
74
|
- bin/console
|
75
75
|
- bin/setup
|
76
76
|
- codebreakergem.gemspec
|
77
|
-
- datadata.yml
|
78
77
|
- lib/classes/difficulty.rb
|
79
78
|
- lib/classes/file_worker.rb
|
80
79
|
- lib/classes/statistic.rb
|
@@ -86,7 +85,6 @@ files:
|
|
86
85
|
- lib/locales/en.yml
|
87
86
|
- lib/locales/ru.yml
|
88
87
|
- lib/modules/check_module.rb
|
89
|
-
- main.rb
|
90
88
|
homepage: https://github.com/SashaZhuravskiy/CodebreakerGemRepo/
|
91
89
|
licenses:
|
92
90
|
- MIT
|
data/datadata.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--- Hello world
|
data/main.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require './lib/codebreakergem.rb'
|
4
|
-
include Codebreakergem
|
5
|
-
|
6
|
-
def hello_message
|
7
|
-
puts 'Hello'
|
8
|
-
end
|
9
|
-
|
10
|
-
def menu
|
11
|
-
puts "Chose action:\n 1) Start\n 2) Rules\n 3) Stats\n 4) Exit\n"
|
12
|
-
end
|
13
|
-
|
14
|
-
def goodbye_message
|
15
|
-
puts "Thank you for playing\nSee you next time"
|
16
|
-
end
|
17
|
-
|
18
|
-
def play_game
|
19
|
-
user = nil
|
20
|
-
user_input = ''
|
21
|
-
puts "Input player's name:"
|
22
|
-
|
23
|
-
loop do
|
24
|
-
user = User.new(gets.chomp)
|
25
|
-
break if user.validate?
|
26
|
-
end
|
27
|
-
game = Game.new(user)
|
28
|
-
|
29
|
-
difficulties = Game::DIFFICULTIES.map(&:name)
|
30
|
-
|
31
|
-
loop do
|
32
|
-
puts "Chose difficulty"
|
33
|
-
difficulties.each {|key| puts " -#{key}"}
|
34
|
-
user_input = gets.chomp
|
35
|
-
break if difficulties.include? user_input
|
36
|
-
puts "Input one of proposed options"
|
37
|
-
end
|
38
|
-
game.difficulty = Game::DIFFICULTIES.find{|item| item.name == user_input}.dup
|
39
|
-
|
40
|
-
|
41
|
-
while game.difficulty.attempts.positive? do
|
42
|
-
puts 'Input your guess:'
|
43
|
-
user_input = gets.chomp
|
44
|
-
next unless game.validate_guess(user_input)
|
45
|
-
if user_input == "hint"
|
46
|
-
puts game.show_hint
|
47
|
-
elsif user_input == "exit"
|
48
|
-
break
|
49
|
-
else
|
50
|
-
puts game.try_guess(user_input)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def game_process
|
56
|
-
hello_message
|
57
|
-
loop do
|
58
|
-
menu
|
59
|
-
case gets.chomp
|
60
|
-
when "Start" then play_game
|
61
|
-
when "Rules" then puts Game.rules
|
62
|
-
when "Stats" then puts Game.stats
|
63
|
-
when "Exit" then break
|
64
|
-
else puts "You have passed unexpected command. Please choose one from listed commands"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
goodbye_message
|
68
|
-
end
|
69
|
-
|
70
|
-
def write_to_file(filename, data)
|
71
|
-
File.open(filename, 'w') { |file| file.write(data.to_yaml) }
|
72
|
-
end
|
73
|
-
|
74
|
-
#puts(File.expand_path('lib/data'))
|
75
|
-
#write_to_file(File.expand_path('lib/data') + 'data.yml', "Hello world")
|
76
|
-
game_process
|