Title / Description
Code def repS(word,n) return false if n==nil x=rand(3) word[n..n]="aS" if x==0 word[n..n]="bD" if x==1 word[n..n]="fR" if x==2 return true end def repD(word,n) return false if n==nil x=n<4 ? rand(2) : rand(5) word[n..n]="cD" if x==0 word[n..n]="d" if (x>1) word[n..n]="fR" if x==1 return true end def repR(word,n) return false if n==nil x=n<4 ? 0 : rand(3) word[n..n]="f" if (x>0) word[n..n]="bR" if x==0 return true end def noCaps(word) return true if word.match(/\p{Upper}/)!=nil return false end 5.times { |i| word="S" print "#{word}->" while ( word.length<5 || noCaps(word) ) do print repS(word,(word.index('S')!=nil ? word.length-1 : nil)) ? "#{word}->" : "" print repR(word,(word.index('R')!=nil ? word.length-1 : nil)) ? "#{word}->" : "" print repD(word,(word.index('D')!=nil ? word.length-1 : nil)) ? "#{word}->" : "" end puts }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code