:::::::::::::: 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 } :::::::::::::: lab2/lab2.1 :::::::::::::: # # CIS 130 (Spring Term) # # Rich Simms # # lab2.1 (gather rings on the mountain and return) # source libfrodo step-up-and-grab () { turnleft move turnright move next_to_ring && pickring } step-down () { move turnleft move turnright } go-back () { step-down step-down step-down } step-up-and-grab step-up-and-grab step-up-and-grab turnaround go-back putring-3 move stop :::::::::::::: lab2/lab2.2 :::::::::::::: # # CIS 130 (Spring Term) # # Rich Simms # # lab2.2 (harvesting a field of rings) # source libfrodo pick-and-go () { next_to_ring && pickring turnright move turnleft move } pick-diag-row () { pick-and-go pick-and-go pick-and-go pick-and-go } next-row-left () { turnleft move move turnleft } next-row-right () { turnaround move move } move pick-diag-row next-row-left pick-diag-row next-row-right pick-diag-row next-row-left pick-diag-row stop :::::::::::::: lab2/lab2.3 :::::::::::::: # # CIS 130 (Spring Term) # # Rich Simms # # lab2.3 (harvesting an incomplete field of rings) # source libfrodo pick-and-go () { next_to_ring && pickring turnright move turnleft move } pick-diag-row () { pick-and-go pick-and-go pick-and-go pick-and-go } next-row-left () { turnleft move move turnleft } next-row-right () { turnaround move move } move pick-diag-row next-row-left pick-diag-row next-row-right pick-diag-row next-row-left pick-diag-row stop