paitin_hangman 0.1.0 → 1.0.0
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/.gitignore +1 -0
- data/README.md +32 -23
- data/lib/.idea/.name +1 -0
- data/lib/.idea/encodings.xml +6 -0
- data/lib/.idea/lib.iml +9 -0
- data/lib/.idea/misc.xml +14 -0
- data/lib/.idea/modules.xml +8 -0
- data/lib/.idea/workspace.xml +215 -0
- data/lib/paitin_hangman.rb +17 -2
- data/lib/paitin_hangman/computer.rb +24 -0
- data/lib/paitin_hangman/game_data.rb +17 -15
- data/lib/paitin_hangman/game_engine.rb +132 -56
- data/lib/paitin_hangman/game_resumption.rb +77 -0
- data/lib/paitin_hangman/levels.rb +36 -168
- data/lib/paitin_hangman/messages.rb +59 -59
- data/lib/paitin_hangman/player.rb +46 -0
- data/lib/paitin_hangman/simple_methods.rb +70 -0
- data/lib/paitin_hangman/version.rb +1 -1
- data/paitin_hangman.gemspec +3 -2
- metadata +30 -14
- data/.DS_Store +0 -0
- data/.travis.yml +0 -4
- data/bin/games.yml +0 -17
- data/games.yml +0 -0
- data/lib/paitin_hangman/.DS_Store +0 -0
- data/lib/paitin_hangman/dictionary.txt +0 -41211
- data/lib/paitin_hangman/extra_methods.rb +0 -80
- data/lib/paitin_hangman/saved_games.rb +0 -89
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d4ae932da07417912239a8f4371e95606b3968d4
|
|
4
|
+
data.tar.gz: ff95638dc25f8ab390005b72d7f2535507a07aff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0c027d025462b50201631fa6059addde0179aee09239768906d169d702b3d8d6f1e00c9939c8d481da532c40bdad5b0b8ba6e9f9f5b7d5dd433441cd122a8f3
|
|
7
|
+
data.tar.gz: 7c006ea45ecd707a2254d94fa73801e57b5ed1fb0d88a32a7f7b9f19afa91885c619faf2c7f36bd99b4f11e1a05f439ff85f5df007848132ce6f8291873abd37
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -3,47 +3,52 @@
|
|
|
3
3
|
|
|
4
4
|
Welcome to my new gem! It is just a classic implentation of the Hangman game.
|
|
5
5
|
|
|
6
|
-
To play this game, just follow the
|
|
6
|
+
To play this game, just follow the simple instructions below
|
|
7
7
|
|
|
8
|
-
## Installation
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
# Installation
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
gem 'paitin_hangman'
|
|
14
|
-
```
|
|
11
|
+
Simply open your terminal and then run
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
```gem install paitin_hangman```
|
|
14
|
+
|
|
15
|
+
If you are on a **windows platform**, open the command prompt and the run the command above
|
|
16
|
+
|
|
17
17
|
|
|
18
|
-
$ bundle
|
|
19
18
|
|
|
20
|
-
Or install it yourself as:
|
|
21
|
-
|
|
22
|
-
$ gem install paitin_hangman
|
|
23
19
|
|
|
24
20
|
## Usage
|
|
25
21
|
|
|
26
|
-
This game is a REPL game, i.e it is being played from and with the **Terminal**. To start it just run `paitin_hangman`.
|
|
22
|
+
This game is a REPL game, i.e it is being played from and with the **Terminal**. To start it just run `paitin_hangman`.
|
|
27
23
|
|
|
28
24
|
Once started, the game is very intuitive and easy to follow.
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*"Welcome to Hangman, the no-nonsense game
|
|
34
|
-
Be smart, then you live. if not, you'll have to die by Hanging.
|
|
26
|
+
###"Welcome to Hangman, the no-nonsense game
|
|
27
|
+
Be smart, then you live. if not, you'll have to die by Hanging.
|
|
35
28
|
You have a couple of options to pick from.....
|
|
36
|
-
Press 'P' or 'play' if you think you are ready for the challenge
|
|
37
|
-
You may press 'I' or 'instructions' for a short explanation of how to play
|
|
38
|
-
You may continue a previously saved game by pressing 'L' or 'load'
|
|
39
|
-
Or you could just quit by pressing a 'Q' or typing 'quit'"
|
|
29
|
+
**`Press 'P' or 'play' if you think you are ready for the challenge`**,
|
|
30
|
+
**`You may press 'I' or 'instructions' for a short explanation of how to play`**
|
|
31
|
+
**`You may continue a previously saved game by pressing 'L' or 'load'`**
|
|
32
|
+
**`Or you could just quit by pressing a 'Q' or typing 'quit'"`**
|
|
40
33
|
"The word to guess is represented by a row of dashes
|
|
41
34
|
These dashes represent each letter of the word.
|
|
42
35
|
Words you cannot use include proper nouns such as names, places, and brands.
|
|
43
36
|
If the guessing player suggests a letter which occurs in the word,
|
|
44
|
-
the other player writes it in all its correct positions."
|
|
37
|
+
the other player writes it in all its correct positions."
|
|
38
|
+
|
|
39
|
+
The guessing player must guess all of the letters of the word within a limited amount of chances. Faiure to do so will result in his death by hanging
|
|
40
|
+
|
|
41
|
+
## Important note
|
|
42
|
+
In player mode, if the player is typing his word, it will not be displayed on the screen, it will be hidden so as not to give the challenged player undue advantage.
|
|
43
|
+
|
|
44
|
+
|
|
45
45
|
## Extras
|
|
46
|
-
|
|
46
|
+
>You can actually reveal the word by pressing `:c` or `cheat`. This is a cheat for solving the problem and it is not recommended.
|
|
47
|
+
|
|
48
|
+
>You can quit at any point by pressing `:q` or typing `quit` whereby you will be asked if you want to save the game or just quit. (The option to save is only available in the computer mode.)
|
|
49
|
+
>
|
|
50
|
+
>If you press `:h` or type `history`, a list showing your guesses will be displayed.
|
|
51
|
+
|
|
47
52
|
|
|
48
53
|
## Development
|
|
49
54
|
|
|
@@ -60,3 +65,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
|
60
65
|
|
|
61
66
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
62
67
|
|
|
68
|
+
|
|
69
|
+
# Enjoy your Hangman experience and try not to be hanged...
|
|
70
|
+
good luck...
|
|
71
|
+
|
data/lib/.idea/.name
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lib
|
data/lib/.idea/lib.iml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
<orderEntry type="library" scope="PROVIDED" name="colorize-0.7.7 (v0.7.7, rbenv: 2.3.0) [gem]" level="application" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
data/lib/.idea/misc.xml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
4
|
+
<OptionsSetting value="true" id="Add" />
|
|
5
|
+
<OptionsSetting value="true" id="Remove" />
|
|
6
|
+
<OptionsSetting value="true" id="Checkout" />
|
|
7
|
+
<OptionsSetting value="true" id="Update" />
|
|
8
|
+
<OptionsSetting value="true" id="Status" />
|
|
9
|
+
<OptionsSetting value="true" id="Edit" />
|
|
10
|
+
<ConfirmationsSetting value="0" id="Add" />
|
|
11
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.3.0" project-jdk-type="RUBY_SDK" />
|
|
14
|
+
</project>
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="4e601dd2-7b8b-4402-9f75-796480109291" name="Default" comment="" />
|
|
5
|
+
<ignored path="lib.iws" />
|
|
6
|
+
<ignored path=".idea/workspace.xml" />
|
|
7
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
8
|
+
<option name="TRACKING_ENABLED" value="true" />
|
|
9
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
10
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
11
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
12
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
13
|
+
</component>
|
|
14
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
|
15
|
+
<component name="CreatePatchCommitExecutor">
|
|
16
|
+
<option name="PATCH_PATH" value="" />
|
|
17
|
+
</component>
|
|
18
|
+
<component name="FavoritesManager">
|
|
19
|
+
<favorites_list name="lib" />
|
|
20
|
+
</component>
|
|
21
|
+
<component name="FileEditorManager">
|
|
22
|
+
<leaf>
|
|
23
|
+
<file leaf-file-name="paitin_hangman.rb" pinned="false" current-in-tab="false">
|
|
24
|
+
<entry file="file://$PROJECT_DIR$/paitin_hangman.rb">
|
|
25
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
26
|
+
<state vertical-scroll-proportion="0.0">
|
|
27
|
+
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
|
|
28
|
+
<folding />
|
|
29
|
+
</state>
|
|
30
|
+
</provider>
|
|
31
|
+
</entry>
|
|
32
|
+
</file>
|
|
33
|
+
<file leaf-file-name="levels.rb" pinned="false" current-in-tab="true">
|
|
34
|
+
<entry file="file://$PROJECT_DIR$/paitin_hangman/levels.rb">
|
|
35
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
36
|
+
<state vertical-scroll-proportion="1.2583222">
|
|
37
|
+
<caret line="63" column="7" selection-start-line="63" selection-start-column="7" selection-end-line="63" selection-end-column="7" />
|
|
38
|
+
<folding />
|
|
39
|
+
</state>
|
|
40
|
+
</provider>
|
|
41
|
+
</entry>
|
|
42
|
+
</file>
|
|
43
|
+
<file leaf-file-name="game_engine.rb" pinned="false" current-in-tab="false">
|
|
44
|
+
<entry file="file://$PROJECT_DIR$/paitin_hangman/game_engine.rb">
|
|
45
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
46
|
+
<state vertical-scroll-proportion="0.0">
|
|
47
|
+
<caret line="59" column="9" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
|
|
48
|
+
<folding />
|
|
49
|
+
</state>
|
|
50
|
+
</provider>
|
|
51
|
+
</entry>
|
|
52
|
+
</file>
|
|
53
|
+
</leaf>
|
|
54
|
+
</component>
|
|
55
|
+
<component name="IdeDocumentHistory">
|
|
56
|
+
<option name="CHANGED_PATHS">
|
|
57
|
+
<list>
|
|
58
|
+
<option value="$PROJECT_DIR$/paitin_hangman/levels.rb" />
|
|
59
|
+
<option value="$PROJECT_DIR$/paitin_hangman/game_engine.rb" />
|
|
60
|
+
</list>
|
|
61
|
+
</option>
|
|
62
|
+
</component>
|
|
63
|
+
<component name="JsBuildToolGruntFileManager" detection-done="true" />
|
|
64
|
+
<component name="JsBuildToolPackageJson" detection-done="true" />
|
|
65
|
+
<component name="JsGulpfileManager">
|
|
66
|
+
<detection-done>true</detection-done>
|
|
67
|
+
</component>
|
|
68
|
+
<component name="ProjectFrameBounds">
|
|
69
|
+
<option name="width" value="1280" />
|
|
70
|
+
<option name="height" value="800" />
|
|
71
|
+
</component>
|
|
72
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
73
|
+
<OptionsSetting value="true" id="Add" />
|
|
74
|
+
<OptionsSetting value="true" id="Remove" />
|
|
75
|
+
<OptionsSetting value="true" id="Checkout" />
|
|
76
|
+
<OptionsSetting value="true" id="Update" />
|
|
77
|
+
<OptionsSetting value="true" id="Status" />
|
|
78
|
+
<OptionsSetting value="true" id="Edit" />
|
|
79
|
+
<ConfirmationsSetting value="0" id="Add" />
|
|
80
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
|
81
|
+
</component>
|
|
82
|
+
<component name="ProjectView">
|
|
83
|
+
<navigator currentView="ProjectPane" proportions="" version="1">
|
|
84
|
+
<flattenPackages />
|
|
85
|
+
<showMembers />
|
|
86
|
+
<showModules />
|
|
87
|
+
<showLibraryContents />
|
|
88
|
+
<hideEmptyPackages />
|
|
89
|
+
<abbreviatePackageNames />
|
|
90
|
+
<autoscrollToSource />
|
|
91
|
+
<autoscrollFromSource />
|
|
92
|
+
<sortByType />
|
|
93
|
+
<manualOrder />
|
|
94
|
+
<foldersAlwaysOnTop value="true" />
|
|
95
|
+
</navigator>
|
|
96
|
+
<panes>
|
|
97
|
+
<pane id="Scope" />
|
|
98
|
+
<pane id="ProjectPane">
|
|
99
|
+
<subPane>
|
|
100
|
+
<PATH>
|
|
101
|
+
<PATH_ELEMENT>
|
|
102
|
+
<option name="myItemId" value="lib" />
|
|
103
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
104
|
+
</PATH_ELEMENT>
|
|
105
|
+
<PATH_ELEMENT>
|
|
106
|
+
<option name="myItemId" value="External Libraries" />
|
|
107
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
|
|
108
|
+
</PATH_ELEMENT>
|
|
109
|
+
</PATH>
|
|
110
|
+
<PATH>
|
|
111
|
+
<PATH_ELEMENT>
|
|
112
|
+
<option name="myItemId" value="lib" />
|
|
113
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
114
|
+
</PATH_ELEMENT>
|
|
115
|
+
<PATH_ELEMENT>
|
|
116
|
+
<option name="myItemId" value="lib" />
|
|
117
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
118
|
+
</PATH_ELEMENT>
|
|
119
|
+
</PATH>
|
|
120
|
+
<PATH>
|
|
121
|
+
<PATH_ELEMENT>
|
|
122
|
+
<option name="myItemId" value="lib" />
|
|
123
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
124
|
+
</PATH_ELEMENT>
|
|
125
|
+
<PATH_ELEMENT>
|
|
126
|
+
<option name="myItemId" value="lib" />
|
|
127
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
128
|
+
</PATH_ELEMENT>
|
|
129
|
+
<PATH_ELEMENT>
|
|
130
|
+
<option name="myItemId" value="paitin_hangman" />
|
|
131
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
132
|
+
</PATH_ELEMENT>
|
|
133
|
+
</PATH>
|
|
134
|
+
</subPane>
|
|
135
|
+
</pane>
|
|
136
|
+
<pane id="Scratches" />
|
|
137
|
+
</panes>
|
|
138
|
+
</component>
|
|
139
|
+
<component name="PropertiesComponent">
|
|
140
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
141
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
142
|
+
<property name="FullScreen" value="true" />
|
|
143
|
+
</component>
|
|
144
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
|
145
|
+
<component name="TaskManager">
|
|
146
|
+
<task active="true" id="Default" summary="Default task">
|
|
147
|
+
<changelist id="4e601dd2-7b8b-4402-9f75-796480109291" name="Default" comment="" />
|
|
148
|
+
<created>1457145525283</created>
|
|
149
|
+
<option name="number" value="Default" />
|
|
150
|
+
<updated>1457145525283</updated>
|
|
151
|
+
</task>
|
|
152
|
+
<servers />
|
|
153
|
+
</component>
|
|
154
|
+
<component name="ToolWindowManager">
|
|
155
|
+
<frame x="0" y="0" width="1280" height="800" extended-state="0" />
|
|
156
|
+
<editor active="true" />
|
|
157
|
+
<layout>
|
|
158
|
+
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
|
159
|
+
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
|
160
|
+
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
|
161
|
+
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
162
|
+
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
163
|
+
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
164
|
+
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
165
|
+
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
|
166
|
+
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
|
167
|
+
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
|
168
|
+
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
169
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
170
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
171
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
|
172
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
|
173
|
+
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
174
|
+
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
|
175
|
+
</layout>
|
|
176
|
+
</component>
|
|
177
|
+
<component name="VcsContentAnnotationSettings">
|
|
178
|
+
<option name="myLimit" value="2678400000" />
|
|
179
|
+
</component>
|
|
180
|
+
<component name="VcsManagerConfiguration">
|
|
181
|
+
<ignored-roots>
|
|
182
|
+
<path value="$PROJECT_DIR$/.." />
|
|
183
|
+
</ignored-roots>
|
|
184
|
+
</component>
|
|
185
|
+
<component name="XDebuggerManager">
|
|
186
|
+
<breakpoint-manager />
|
|
187
|
+
<watches-manager />
|
|
188
|
+
</component>
|
|
189
|
+
<component name="editorHistoryManager">
|
|
190
|
+
<entry file="file://$PROJECT_DIR$/paitin_hangman.rb">
|
|
191
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
192
|
+
<state vertical-scroll-proportion="0.0">
|
|
193
|
+
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
|
|
194
|
+
<folding />
|
|
195
|
+
</state>
|
|
196
|
+
</provider>
|
|
197
|
+
</entry>
|
|
198
|
+
<entry file="file://$PROJECT_DIR$/paitin_hangman/game_engine.rb">
|
|
199
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
200
|
+
<state vertical-scroll-proportion="0.0">
|
|
201
|
+
<caret line="59" column="9" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
|
|
202
|
+
<folding />
|
|
203
|
+
</state>
|
|
204
|
+
</provider>
|
|
205
|
+
</entry>
|
|
206
|
+
<entry file="file://$PROJECT_DIR$/paitin_hangman/levels.rb">
|
|
207
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
208
|
+
<state vertical-scroll-proportion="1.2583222">
|
|
209
|
+
<caret line="63" column="7" selection-start-line="63" selection-start-column="7" selection-end-line="63" selection-end-column="7" />
|
|
210
|
+
<folding />
|
|
211
|
+
</state>
|
|
212
|
+
</provider>
|
|
213
|
+
</entry>
|
|
214
|
+
</component>
|
|
215
|
+
</project>
|
data/lib/paitin_hangman.rb
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
require_relative "paitin_hangman/messages"
|
|
2
|
-
require_relative "paitin_hangman/saved_games"
|
|
3
1
|
require_relative "paitin_hangman/version"
|
|
2
|
+
require_relative "paitin_hangman/messages"
|
|
3
|
+
require_relative "paitin_hangman/game_resumption"
|
|
4
|
+
require_relative "paitin_hangman/simple_methods"
|
|
4
5
|
require_relative "paitin_hangman/game_engine"
|
|
6
|
+
require_relative "paitin_hangman/computer"
|
|
7
|
+
require_relative "paitin_hangman/player"
|
|
5
8
|
module PaitinHangman
|
|
6
9
|
class Paitin
|
|
7
10
|
include SimpleMethods
|
|
@@ -42,5 +45,17 @@ module PaitinHangman
|
|
|
42
45
|
puts "Hi #{name}, Select a mode"
|
|
43
46
|
play(name)
|
|
44
47
|
end
|
|
48
|
+
|
|
49
|
+
# => This technically begins the game
|
|
50
|
+
def play(name)
|
|
51
|
+
Message.game_type
|
|
52
|
+
option_integrity
|
|
53
|
+
if @option == "2"
|
|
54
|
+
Computer.new.level_integrity(name)
|
|
55
|
+
else
|
|
56
|
+
Player.new.first_player_name(name)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
45
60
|
end
|
|
46
61
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module PaitinHangman
|
|
2
|
+
class Computer
|
|
3
|
+
def initialize
|
|
4
|
+
Message.level_choice
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def level_integrity(name)
|
|
8
|
+
choice = gets.chomp
|
|
9
|
+
until choice == "1" || choice == "2" || choice == "3"
|
|
10
|
+
puts "Please press either '1', '2' or '3'"
|
|
11
|
+
choice = STDIN.gets.chomp
|
|
12
|
+
end
|
|
13
|
+
level(choice, name)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def level(choice, name)
|
|
17
|
+
case choice
|
|
18
|
+
when "1" then Levels.new(name, 4, 8, 10)
|
|
19
|
+
when "2" then Levels.new(name, 9, 12, 12)
|
|
20
|
+
when "3" then Levels.new(name, 13, 25, 15)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
module PaitinHangman
|
|
2
|
-
class GameData
|
|
3
|
-
|
|
2
|
+
class GameData
|
|
3
|
+
attr_reader :player_name, :misses, :right_guesses,
|
|
4
|
+
:chances, :word_control, :game_word, :count
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
def initialize(player_name, misses, right_guesses, chances, word_control,
|
|
7
|
+
game_word, count)
|
|
8
|
+
@player_name = player_name
|
|
9
|
+
@misses = misses
|
|
10
|
+
@right_guesses = right_guesses
|
|
11
|
+
@chances = chances
|
|
12
|
+
@word_control = word_control
|
|
13
|
+
@game_word = game_word
|
|
14
|
+
@count = count
|
|
15
|
+
end
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
def to_s
|
|
18
|
+
"#{player_name} ===>>> #{word_control.upcase.gsub('_', '__ ')}\n"\
|
|
19
|
+
"\t #{chances} chances left and you have used #{misses.join(', ')}\n"
|
|
20
|
+
end
|
|
18
21
|
end
|
|
19
|
-
end
|
|
20
22
|
end
|