-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.jl
205 lines (153 loc) · 3.86 KB
/
game.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
title = """
___ ___ ___ ___ ___ ___ ___
/__/\\ / /\\ /__/\\ / /\\ /__/\\ / /\\ /__/\\
\\ \\:\\ / /::\\ \\ \\:\\ / /:/_ | |::\\ / /::\\ \\ \\:\\
\\__\\:\\ / /:/\\:\\ \\ \\:\\ / /:/ /\\ | |:|:\\ / /:/\\:\\ \\ \\:\\
___ / /::\\ / /:/~/::\\ _____\\__\\:\\ / /:/_/::\\ __|__|:|\\:\\ / /:/~/::\\ _____\\__\\:\\
/__/\\ /:/\\:\\ /__/:/ /:/\\:\\ /__/::::::::\\ /__/:/__\\/\\:\\ /__/::::| \\:\\ /__/:/ /:/\\:\\ /__/::::::::\\
\\ \\:\\/:/__\\/ \\ \\:\\/:/__\\/ \\ \\:\\~~\\~~\\/ \\ \\:\\ /~~/:/ \\ \\:\\~~\\__\\/ \\ \\:\\/:/__\\/ \\ \\:\\~~\\~~\\/
\\ \\::/ \\ \\::/ \\ \\:\\ ~~~ \\ \\:\\ /:/ \\ \\:\\ \\ \\::/ \\ \\:\\ ~~~
\\ \\:\\ \\ \\:\\ \\ \\:\\ \\ \\:\\/:/ \\ \\:\\ \\ \\:\\ \\ \\:\\
\\ \\:\\ \\ \\:\\ \\ \\:\\ \\ \\::/ \\ \\:\\ \\ \\:\\ \\ \\:\\
\\__\\/ \\__\\/ \\__\\/ \\__\\/ \\__\\/ \\__\\/ \\__\\/
He doesn't know that your IQ may lead to his demise.
"""
hang_boi_stages = [
"""
+---+
| |
|
|
|
|
=========
Hey Waddup Bruv ! How You Doin' ?
""",
"""
+---+
| |
O |
|
|
|
=========
Bro WTH ! Why's there's a noose around mah Neck!?
""",
"""
+---+
| |
O |
| |
| |
|
|
=========
Dude Seriously ! What are you doing ????
""",
"""
+---+
| |
O |
/| |
| |
|
|
=========
Aww Crap ! You're trying to hang me! right ?
""",
"""
+---+
| |
O |
/|\\ |
| |
|
|
=========
Bro You should've given up by now YO! SRSLY...
""",
"""
+---+
| |
O |
/|\\ |
| |
/ |
|
=========
Ok Ok! Go On! You are of no use.... You'll kill me I'm sure now!
""",
"""
+---+
| |
O |
/|\\ |
| |
/ \\ |
|
=========
________
||
||
------
||
||
|| in the CHATS!
"""
]
println(title)
chanceOn = 1
someoneWon = false
function show_boi()
global chanceOn = chanceOn+1
println(hang_boi_stages[chanceOn])
end
function initialize()
println("Player 1, Enter Word (give a difficult one, rek PL2 !) : ")
global word = string(readline())
global word_lis = collect(word)
println("""
""")
sleep(2)
global guess_lis = fill('_', length(word_lis))
global guessword = join(guess_lis) #using join method to bring elements of guess_lis in a string
end
function check()
letFound = false
println("Player 2, Guess a letter of this word (single character): ")
user_inp = string(readline())
user_inp = collect(user_inp)
if length(user_inp) == 1#continuing if input is single character
else
println("Don't try to be SMORT! Enter single letter at a time.")
user_inp = string(readline())
end
for i=1:length(word_lis)#checking and replacing for correct string.
if word_lis[i]==user_inp[1]
guess_lis[i] = word_lis[i]
letFound = true
println("Yeet! Correct Letter")
end
end
if letFound == false
show_boi()
end
guess = join(guess_lis)
print(guess)
println("")
end
initialize()
println(guessword) #printing the dashed/currently dashed word
while (someoneWon == false && chanceOn<7)
check() #calling our function
if word_lis == guess_lis
someoneWon = true
println("Ahh! You saved the Hang Boi! Great Job\n Player 2 Wins!")
break
end
if chanceOn>=7
print("F! Hang Boi is Ded. All because of you.\n Player 1 Wins!")
break
end
end
#