ももたろう
- 14. def "ももたろうのストーリー"(){
Calendar cal = Calendar.instance
cal.add(Calendar.YEAR, -400)
def uncle,aunt
Location.set(Japan,aDeepForest)//TODO a village?
uncle = PersonFactory.newInstance()
aunt = PersonFactory.newInstance()
uncle.move(new Location(20,30),100)//mountain
while(true){
Branch b = getBranch()
if( b == null){
break;
}
uncle.pickup(b)
}
aunt.move(new Location(-30,0),-40)//river
for(i=0;i<23;i++){
Clothes c = getClothes (i);
aunt.wash(c)
}
River.flow(new RiverHandler(aunt){
def "catch"(donbrako,aunt){
peach = (Peach)donbrako
aunt.keep(peach)
}
})
def momotaro
try{
aunt.cutPeach()
}catch(PeachSelfSplitedException e){
momotaro = e.birth
}
}
}
- 15. def "ももたろうのストーリー"(){
aLongLongTimeAgo()
aDeepForest()
def [uncle,aunt] = live()
uncle.goMountain()
uncle.pickUpBranch(allArround())
aunt.goRiver()
aunt.washClothes()
eventAtRiver(aunt)
def momotaro = birth(aunt.getKeepedPeach)
}
def eventAtRiver(aunt){
River.flow(new RiverHandler(aunt){
def "catch"(donbrako,aunt){
peach = (Peach)donbrako
aunt.keep(peach)
}
})
}
def birth(peach){
def momotaro
try{
aunt.cutPeach(new CutPeachHandler(){
def handle(peach){
momotaro = peach.birth
}
})