在第一场比赛开始前的30min,裁判给予信号,表明比赛正式开幕。第二次给信号是在开始前的15min。在这时,参加比赛的马匹都要进入赛前遛马场亮相。按照裁判的信号,参赛的骑手都骑马进入跑道,给马做准备活动。马鞍的左侧和右侧都应该有号码,同程序册中的号码一样。骑手参加比赛都穿着规定样式和颜色的服装,戴着保护头盔。在比赛前的2~3min给第三次信号,骑手马上进入标有自己号码的起点上,并按起跑员的命令开始比赛。所有不参加比赛的马匹在听到第三次信号时全部应离开跑道。在比赛时,在跑道上遛马是禁止的。
#!/bin/shgenmpost()
{
cat - <<EOF
def Drawhorses(expr ha,hb,hc,hd)=
begingroup
save i, line_s, line_e, line_w, line_h, line_hw
pair line_s, line_e, line_h
line_s:=(0,0)line_e:=(5cm,0)
line_w:=8mm
line_h:=(0,2mm)line_hw:=4mm
draw (-3,-3mm) withcolor white
draw (53mm,35mm) withcolor white
for i=0 step 1 until 4:
draw (line_s -- line_e) shifted (0,line_w*i) withpen pencircle scaled 3pt
numeric myshift
if i=0: myshift:=haelse: if i=1: myshift:=hbelse: if i=2: myshift:=hcelse: myshift:=hdfififi
if i<=3:
draw (line_h -- line_h shifted (line_hw,0) -- line_h shifted (line_hw, line_hw) -- line_h shifted(0, line_hw) -- cycle) shifted (myshift, i*line_w) withpen pencircle scaled 4pt
fi
endfor
endgroup
enddef
EOF
awk 'BEGIN{
"date +%s" | getline myseedsrand(myseed)
ha=0hb=0hc=0hd=0myend=46i=1000
while(ha <myend &&hb <myend &&hc <myend &&hd <myend )
{
ha+=rand()*2
hb+=rand()*2
hc+=rand()*2
hd+=rand()*2
printf("beginfig(%3d)\n",i++)
printf("Drawhorses(%fmm,%fmm,%fmm,%fmm)\n",ha,hb,hc,hd)
print "endfig"
}
print "end"
exit
}'
}
genmpost >mytmpmposthorse.mp
mptopdf mytmpmposthorse.mp
convert -sampling-factor 1 mytmpmposthorse-[0-9]???.pdf horses.gif
rm mytmpmposthorse-[0-9]???.pdf
rm mytmpmposthorse.[0-9]???
rm mytmpmposthorse.mp
给你个思路吧,设定5个定时器,当然也可以用一个定时器,不过先被判断的马优势比较大。用随机数,10*rand(),这样就可以每次走10以内的随机数。然后图片的X+随机数,图片就移动过去了。然后先到终于的马就胜出,接下来就是你做的处理,赔钱或收钱了,哈哈欢迎分享,转载请注明来源:内存溢出
评论列表(0条)