(* †bungen zur Vorlesung Informatik I, WS 2003/04 Programmieraufgabe P-23 :: landkarte.ml ---------------------------------------------- Leonhard Fellermayr, Mat. Nr. 22128130XXXX NICHT-REKURSIVE FASSUNG *) (* Schema/GesetzmŠ§igkeit: 2 | B S | S W B | S W B | S W B | . . . 1 | S B | S S B | S S B |ĘS S B | . . . 0 | W B | S W B |ĘS W B | S W B | . . . ------------------------------- | 0 1 | 2 3 4 | 5 6 7 | 8 9 10| . . . 0 -> WŸste 1 -> See 2 -> Berg *) let what (x,y) = (* Seen *) if (x-2) mod 3 == 0 || ( (y-1) mod 3 == 0 && x mod 3 == 0 ) || ( (y-2) mod 3 == 0 && x == 1 ) then 1 (* Berge *) else if (x-1) mod 3 == 0 || ( (y-2) mod 3 == 0 && x == 0) then 2 (* WŸsten *) else 0 (* Ab hier werden die in der Aufgabenstellung verlangten Funktionen definiert. Sie greifen auf what (x,y) zurŸck und geben einen Wert vom Typ bool zurŸck. *) let wueste (x,y) = if (what(x,y) == 0) then true else false;; let see (x,y) = if (what(x,y) == 1) then true else false;; let berg (x,y) = if (what(x,y) == 2) then true else false;;