Skip to content

Instantly share code, notes, and snippets.

#TO DO: import puzzle file, puzzle generator, solutions view omitting unused characters, solutions view highlighting selected words, verbose options, test multiple solutions
samplepuzzle = [ ['b', 'b', 'c', 'd', 'e'],
['f', 'e', 'g', 'g', 'j'],
['k', 'a', 'l', 'o', 'o'],
['s', 'r', 's', 'l', 's'],
['u', 's', 'w', 'd', 'y']]
samplebank = [%w{b e a r s}, %w{e g g}, %w{g o l d}, %w{b e l l}]
x = [1,2]
y = x
y[0] = 2
print x; print y #=> [2,2][2,2]
example = [ ['a', 'b', 'c', 'd', 'e'],
['f', 'g', 'h', 'i', 'j'],
['k', 'l', 'm', 'n', 'o'],
['p', 'q', 'r', 's', 't'],
['u', 'v', 'w', 'x', 'y']]
$letterhash = Hash.new
('a'..'z').each do |letter|
row = 0
Shoes.app :margin => 20, :width => 360 do
flow :width => 1.0, :height => 30 do
background gray(0.5)
stack :width => 0.5 do
para strong "Magic Tool", :size => 14
end
stack :width => 0.25
stack :width => 0.25 do
flow do
button("+") {}
# TO DO: fix difficulty
columns = Array.new
# rows inside columns ; (y, x)
def createmap(mcolumns) #sticks rows in columns
asdf = 0
while asdf < $boardy
rows = Array.new($boardx) {'.'}
mcolumns.push(rows)
asdf += 1
filename = ARGV.first
text = ''
text = File::open(filename)
readit = text.read
contents = readit.downcase.split(/\n+/)
class String
def findchar(n)
self[n,1] #gets nth character
end
end
example = ['banana', 'elephant', 'apple', 'friday', 'cocaine', 'damage']
array = example
parray = Array.new
puts "Welcome to Super Tic-Tac-Toe. I wear shiny spandex."
#---opp CHOOSER
teamrand = rand(0..1)
if teamrand == 0
team = 'x'
opp = 'o'
puts "You're x, you go first."
elsif teamrand == 1
team = 'o'
class String
def initial
self[0,1] #gets first character
end
def twoinitial
self[0,2] #gets first two characters
end
def secondy
self[1,1]
end
def prompt()
print "-> "
end
class Medical
def bed()
puts "You awake to the sound of alarms and flames. You're lying on a bed 3 meters from a raging fire. What do you do?"