Rubyの宿題教えてくだ ..
310:デフォルトの名無しさん
09/01/05 10:20:05
# つづき
def start
@reset.state = :disabled
@start.configure(:text=>'確認',:command=>proc{check})
@cells.each {|line| line.each {|cell| cell.state = :normal ; cell.value = '' }}
@cells[0][0].focus
@starttime = Time.now
end
def check
@endtime = Time.now
@cells.each_with_index do |line,r|
line.each_with_index do |cell,c|
y,x = @row[r].text.to_i,@column[c].text.to_i
case @op.text
when '+' then answer = y + x
when '-' then answer = y - x
when '*' then answer = y * x
end
( cell.focus ; Tk.bell ; return ) if answer != cell.value.to_i
end
end
time = @endtime - @starttime
TkDialog.new(@root,:buttons=>[:OK],:message=>"#{time.to_i}秒かかりました")
init
end
def random(min,max) ; rand(max - min + 1) + min ; end
def run ; init ; Tk.mainloop ; end
end
# $test = true
Drill100.new(Tk.root).run
次ページ最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5380日前に更新/99 KB
担当:undef