Skip to content

Instantly share code, notes, and snippets.

@trentont101
trentont101 / GLOOMMUD
Last active January 3, 2016 17:08
A very simple textual adventure
# This is a very simple textual adventure taking place in gloomville UNFINISHED -- feel free to finish it and send me a copy :)
def room1
puts "You are walking down a pale grey road with rather boring shrubs and trees besides you to the east and west. A sign to the west catches your attentions. A gate blocks the path to your south as the road continues on to the north"
puts "Exits : north"
puts ' '
action = gets.chomp
if action == 'read sign'
puts ' '
puts ' The sign reads..'
@nathanl
nathanl / transpose_lyrics.rb
Created December 5, 2012 10:11
Rearrange song lyrics so it's easier to put guitar chords over them
#!/usr/bin/env ruby
# Rearrange song lyrics so it's easier to put guitar chords over them: put the
# first lines of each verse, which share the same chords, into the first
# paragraph. Second lines go into the second paragraph, etc.
#
# Meant to be used with Unix piping: `cat somefile.txt | ./this_script > output.txt
lyrics = STDIN.read
paragraphs = lyrics.split("\n\n")
lines = paragraphs.map { |paragraph| paragraph.split("\n") }