Skip to content

Instantly share code, notes, and snippets.

@chadjemmett
Created September 18, 2013 00:08
Show Gist options
  • Save chadjemmett/6602583 to your computer and use it in GitHub Desktop.
Save chadjemmett/6602583 to your computer and use it in GitHub Desktop.
A string generator for a programming challenge.
array = []
random_number = rand(5) + 5
string = ""
walls_and_halls = ["W", "."]
(random_number * random_number + 1).times { string << walls_and_halls.sample }
string = string.chop!
string[0] = random_number.to_s
string[1] = "S"
string[string.length] = "E"
puts string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment