api:documentation:kara:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende ÜberarbeitungLetzte ÜberarbeitungBeide Seiten der Revision | ||
api:documentation:kara:start [2023/02/24 22:13] – angelegt Martin Pabst | api:documentation:kara:start [2023/02/24 22:34] – [Welt erstellen] Martin Pabst | ||
---|---|---|---|
Zeile 6: | Zeile 6: | ||
===== Welt erstellen ===== | ===== Welt erstellen ===== | ||
+ | < | ||
+ | <div class=" | ||
+ | |||
+ | <script type=" | ||
+ | JavaKaraWorld jkw = new JavaKaraWorld(10, | ||
+ | println(jkw.WEST); | ||
+ | jkw.init(""" | ||
+ | tttttttttt | ||
+ | t l l lt | ||
+ | tttttttttt | ||
+ | m m m m | ||
+ | """ | ||
+ | Kara kara = new Kara(jkw, 1, 1, jkw.EAST); | ||
+ | |||
+ | if(kara.onLeaf()) { kara.removeLeaf(); | ||
+ | else { kara.putLeaf(); | ||
+ | |||
+ | while (!kara.treeFront()) { | ||
+ | | ||
+ | | ||
+ | kara.removeLeaf(); | ||
+ | } else { | ||
+ | kara.putLeaf(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Aufgabe mit Lösung ===== | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | |||
+ | <script type=" | ||
+ | new Lösung1().run(); | ||
+ | |||
+ | class Lösung1 extends JavaKaraAufgabe1 { | ||
+ | | ||
+ | if(kara.onLeaf()) { kara.removeLeaf(); | ||
+ | else { kara.putLeaf(); | ||
+ | |||
+ | while (!kara.treeFront()) { | ||
+ | | ||
+ | | ||
+ | kara.removeLeaf(); | ||
+ | } else { | ||
+ | kara.putLeaf(); | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <script type=" | ||
+ | class JavaKaraAufgabe1 { | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | world = new JavaKaraWorld(9, | ||
+ | world.scale(2); | ||
+ | |||
+ | world.init(""" | ||
+ | ttttttttt | ||
+ | t l ll lt | ||
+ | ttttttttt | ||
+ | """ | ||
+ | | ||
+ | kara = new Kara(world, 1, 1, world.EAST); | ||
+ | |||
+ | println(" | ||
+ | } | ||
+ | |||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ |
api/documentation/kara/start.txt · Zuletzt geändert: 2023/02/24 22:36 von Martin Pabst