Kodama's home / tips.
和, 差, 積の計算問題を繰り返し行う事で, 算数の学力があがるという. ここでは, この 100マス計算のプリントを作成する. "脳を鍛える..." とは違って, コンソール出力というのは無理があるようなので,印刷に特化した.
和,差,積の混合問題は 脳を鍛える計算ドリル を使う.
家庭での学習用や授業で使いたい方はどうやって問題プリントを調達しているんでしょう? 陰山先生の冊子を印刷しているんでしょうか?
ruby と LaTeX を使いこなしている人なら, この程度のスクリプトは見せられるまでも無い.
つまり,このページに意味があるのは,
((100マス計算プリントが必要)かつ
(ruby と LaTeX が使え)かつ
(自分ではスクリプトを作っていない))
ような人.
とんでもなくピンポイントのような...
居るのかなぁ...
web 上ダウンロードできるページもいろいろとあるので, このページを出す意義はほとんど無いような気がしてきた.
$ ./e100.rb > sample.tex
A4用紙への印刷結果:
#!/usr/local/bin/ruby
# e100.rb
# K.Kodama 2004-08-10.
#
# Usage1: ./e100.rb > sample.tex
Tbl=Array.new;
def tbl_init
Tbl.clear;
for a in 0..9;
Tbl.push(a);
end;
end;
def r_ex
if Tbl.size==0 then tbl_init; end;
return Tbl.delete_at(rand(Tbl.size))
end;
def tex_begin
# LaTeX a4j 版,
print "\\documentclass[a4j]{jarticle}\n\\begin{document}\\pagestyle{empty}\\LARGE\\underline{氏名\\hspace*{3cm}}\\vfill\n"
end
def tex_end
print "\\end{document}\n"
end
def tex_100(t=0)
# 100問
# t=0:+, 1:-, 2:x
print ("\\begin{tabular}{r||"+"r|"*10 + "}\n")
case t
when 0 then print "+ "; 10.times{print ("&~"+"\\phantom{1}"+r_ex.to_s+"~")}
when 1 then print "− "; 10.times{print ("&~"+"1"+r_ex.to_s+"~")}
when 2 then print "× "; 10.times{print ("&~"+"\\phantom{1}"+r_ex.to_s+"~")}
end
print ("\\\\ \\hline\\hline\n")
10.times{print (r_ex.to_s+(" &"*10)+" \\\\ \\hline\n")}
print "\\end{tabular}\\vfill\n"
end;
def tex_time(d="\\underline{\\hspace*{1cm}月\\hspace*{1cm}日} ")
print "\\hfill"+d+"所要時間\\underline{\\hspace*{1cm}分\\hspace*{1cm}秒}\\vfill\n"
end
srand;
t=0 # 0: 足し算, 1: 引き算, 2: かけ算
tex_begin; tex_100(t); tex_time; tex_100(t); tex_time; tex_end
# end of the script.
Kodama's home / tips.