enough code to build the next bit of the animatic
This commit is contained in:
parent
3b72db01ee
commit
96d24f3777
41
generate.rb
Executable file
41
generate.rb
Executable file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# basic: scramble 26 letters so that none are the same
|
||||
|
||||
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
@scrambled_letters = ""
|
||||
|
||||
def is_scrambled?
|
||||
@scrambled_letters.split(//).each_with_index do |letter, index|
|
||||
return false if letter == LETTERS[index]
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
done = false
|
||||
|
||||
while !done
|
||||
@scrambled_letters = LETTERS.split(//).shuffle.join
|
||||
|
||||
done = is_scrambled?
|
||||
end
|
||||
|
||||
@scrambled_letters.split(//).each_with_index do |letter, index|
|
||||
puts "#{LETTERS[index]} - #{letter}"
|
||||
end
|
||||
|
||||
# advanced: add symbols that mean common letters that also modify
|
||||
# the prior letter
|
||||
#
|
||||
# order based on http://pi.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequencies.html
|
||||
|
||||
COMMON_LETTERS = "ETAOINSRH"
|
||||
SYMBOLS = "!@#$%&*+="
|
||||
|
||||
adjustments = COMMON_LETTERS.split(//).shuffle.each_with_index.each_with_object({}) do |(letter, index), obj|
|
||||
obj[SYMBOLS[index]] = { letter: letter, prior_adjustment: rand(7)-3 }
|
||||
end
|
||||
|
||||
pp adjustments
|
Loading…
Reference in New Issue
Block a user