ALL EN FR ES IT

Logo

≡ ▲

Rotkäppchen in BASIC implementiert

GLOBAL 
Typ mensch 
   mutter 
   maedchen
   grossmutter
End Typ
maedchen < mutter
mutter < grossmutter
Typ Raubtier
   wolf
End Typ
Typ Pflanze
   waldbaum
   blume
End Typ
mutter, maedchen, grossmutter = 1
wolf = 0
waldbaum, blumen = array 1 to 1000
messer, jaeger = 0
Programm rotkaeppchen; rem von Herrn Grimm
grossmutter = :-(
mutter = rotkaeppchen + korb
mutter = gosub rotkaeppchen to grossmutter
for wald = 1 to 1000
   waldbaum = waldbaum + 1
   if waldbaum = 500 then wolf = visible then
      if blumen = schoen then
         for rotkaeppchen = 1 to 250
            blumen = blumen - 1 
         next rotkaeppchen
      end if
   end if
next wald
wolf = wolf +grossmutter 
if wolf.augen or
   wolf.mund or
   wolf.ohren > grossmutter.augen or
                grossmutter.mund or
                grossmutter.ohren
   then rotkaeppchen misstrauisch
wolf = wolf + rotkaeppchen
jaeger = 1
if jaeger = 1 then messer = 1
if messer = 1 then jaeger
   grossmutter = wolf(mid$(5 to10)
   rotkaeppchen = wolf(mid$(l1 to 12)
end if
messer = 0
for jaeger= 1 to 100
   wolf = wolf + stein
next jaeger
wolf = 0
grossmutter = :-)
rotkaeppchen = :-)
jaeger = :-)
rotkaeppchen return to mutter
mutter= :-)