资 源 简 介
面这段代码模拟了龟兔赛跑爬山的情况,其中有个时钟触发设置每秒执行一次循环,乌龟的规则是:50% 的机会快走(右移三格) 20% 的机会下滑(左移六格) 30% 的机会慢走(右移一格). 兔子的规则是:20% 的机会睡觉(不移动) 20% 的机会大跳(右移九格) 10% 的机会大滑(左移十二格) 30% 的机会小跳(右移一格) 20% 的机会小滑(左移两格). 其中最先走到整 70 格的胜利,超过 70 格的从头开始 程序在一条线上打印了龟兔移动的轨迹,当两者重合时打印 P 乌龟用 G 表示,兔子用 T 表示. -face this code to simulate the hand of the mountain, which has a clock installed trigger the implementation of a second cycle of the turtle is a rule : 50% chance of brisk walking (3 Georgia shift to right) 20% chance of decline (6 bits grid) 30% chance of walking (a shift to right field) . rabbit is a rule : 20% of the opportunity to sleep (mobile) 20% chance of play (9 Georgia shift to right) 10% of the opportunities in Waterloo (12 bits grid) 30% chance of a small jump (shift to right a grid) 20% chance of a small slip (2 bits grid). One of the most first come the whole grid of 70 victories, more than 70 grid start again from scratch in a process of the turtles online print rabbit mobile track, when the two P Print coincides wit