[Ruby] Lockpick 04-24-2015, 03:41 PM
#1
I got bored in class so I decided to make my first game (discounting Tic Tac Toe because it's not original) in Ruby.
I'd like to say it models the Skyrim lockpick system but I know absolutely nothing about TES.
The goal of this game is to, well, pick the lock. This is accomplished by using the available actions in a specific order, generated by the computer.
I may update later but for the meantime, enjoy!
I'd like to say it models the Skyrim lockpick system but I know absolutely nothing about TES.
The goal of this game is to, well, pick the lock. This is accomplished by using the available actions in a specific order, generated by the computer.
I may update later but for the meantime, enjoy!
Code:
#lockpicker by Touka, ©2015
puts "enter difficulty (1-infinity):"
@diff = gets.to_i + 1
actions = [1, 2, 3, 4, 5, 6]
@sequence = []
@diff.times do |action|
action = actions.sample
@sequence << action
end
@completed = 0
@x = 0
def pick
system "cls"
puts """
_____
// \\\\
// \\\\
|| ||
|| ||
-----------
/ __ \\
| / \\ |
| | | |
| || |
| || |
\\ /
---------
progress:
#{@progress}
last attempt: #{@yn}
Options:
[1] Jab [4] Force
[2] Bump [5] Drag
[3] Tap [6] Swipe
"""
cact = gets.to_i
if cact == @sequence[@x]
@completed += 1
@x += 1
@yn = "Success"
else
if @x != 0
@completed -= 1
@x -= 1
else
@completed = 0
@x = 0
end
@yn = "Failed"
end
if @completed == @diff
system "cls"
puts"""
_____
// \\\\
// \\\\
|| ||
||
||
----------- Success!
/ __ \\
| / \\ |
| | | |
| || |
| || |
\\ /
---------
"""
sleep
else
@progress = "#{@completed} / #{@diff}"
pick
end
end
pickIt's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.















![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)




