/home/cis130/simmsric $ more bin/libfrodo lab3/lab3 :::::::::::::: bin/libfrodo :::::::::::::: # # CIS 130 (Spring 2007) # # Rich Simms # # Function library (libfrodo) # # Include this file into your code with "source libfrodo" # turnleft () { turnright turnright turnright } turnaround () { turnright turnright } backup () { turnaround move turnaround } twirl () { turnaround turnaround } putring-3 () { putring twirl; twirl; twirl # Slows it down so we can watch ring count putring twirl; twirl; twirl # Slows it down so we can watch ring count putring twirl; twirl; twirl # Slows it down so we can watch ring count } :::::::::::::: lab3/lab3 :::::::::::::: # # CIS 130 (Spring Term) # # Rich Simms # # lab3.2 (steeple chase) # source libfrodo check_for_ring () { next_to_ring && pickring } jump_hurdle () { turnleft while ! is_clear RIGHT; do move; done #go up turnright; move; turnright; move #over the top while is_clear; do move; done #go down turnleft } advance () { if is_clear then move else jump_hurdle fi } # Main program starts here check_for_ring while ! any_rings do advance check_for_ring done stop