nido #4608(2007/12/05 02:18 GMT) [ Ruby ] Rating1/1=1.00
普通のやり方ですか。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
TEXT=<<-EOS リオウウリウ ウオリウオリ オリリオリウ リリオオウオ EOS WORD="ウオリ" M_TEXT=TEXT.split("\n").map{|e| e.split(//)} A_WORD=WORD.split(//) S_DEST=[ ["上",-1,0],["右上",-1,1],["右",0,1],["右下",1,1], ["下",1,0],["左下",1,-1],["左",0,-1],["左上",-1,-1] ] M_TEXT.each_with_index do |line,y| line.each_with_index do |c,x| next unless c==A_WORD[0] S_DEST.each do |desc,dy,dx| unless (1...A_WORD.size).find do |i| ((y+dy*i<0)||M_TEXT[y+dy*i].nil?)|| (x+dx*i<0)||(M_TEXT[y+dy*i][x+dx*i]!=A_WORD[i]) end puts "#{desc}(#{x},#{y})" end end end end
Rating1/1=1.00-0+
[ reply ]
nido #4608() [ Ruby ] Rating1/1=1.00
普通のやり方ですか。
Rating1/1=1.00-0+
[ reply ]