This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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..' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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") } |