Login Register


[Ruby] Lockpick filter_list
Author
Message
[Ruby] Lockpick #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!

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 pick
It'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.

Reply

RE: [Ruby] Lockpick #2
How do i go about testing the game?

Reply

RE: [Ruby] Lockpick #3
(04-24-2015, 03:50 PM)SimPlaysGames Wrote: How do i go about testing the game?

If you have the Ruby framework installed, paste the code in a text file and save it as lockpick.rb (or anything ending in .rb).

If you don't have Ruby installed, there's instructions for installation here. (if the rubyinstaller.org link doesn't work, remove the "www.")
It'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.

Reply

RE: [Ruby] Lockpick #4
(04-24-2015, 03:58 PM)Touka Wrote: If you have the Ruby framework installed, paste the code in a text file and save it as lockpick.rb (or anything ending in .rb).

If you don't have Ruby installed, there's instructions for installation here. (if the rubyinstaller.org link doesn't work, remove the "www.")

Thanks, tested it there is some peoblems
You can't pick too high numbers is one of them

Reply

RE: [Ruby] Lockpick #5
(04-24-2015, 04:11 PM)SimPlaysGames Wrote: Thanks, tested it there is some peoblems
You can't pick too high numbers is one of them

It's supposed to be different actions of picking a padlock, not a combination lock. I may use that, eventually.
It'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.

Reply







Users browsing this thread: