gf2:projekte:2024:minecraft:2d2gruppe3

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
gf2:projekte:2024:minecraft:2d2gruppe3 [2025/04/13 22:22] blumlgf2:projekte:2024:minecraft:2d2gruppe3 [2025/04/15 11:03] (aktuell) marroc
Zeile 1: Zeile 1:
 Gruppe 3 Gruppe 3
 +
 Idee: Eine Burg mit Türmchen; siehe Bild in Teamschat Idee: Eine Burg mit Türmchen; siehe Bild in Teamschat
 +
 Ziel: Den versteckten Schatz finden, welcher in der Burg versteckt ist.  Ziel: Den versteckten Schatz finden, welcher in der Burg versteckt ist. 
 +
 - Verwinkelte Räume (Labyrinth)  - Verwinkelte Räume (Labyrinth) 
  
  
 +<code python>
 **Code** **Code**
  
 # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
- 
 #  Nutzung #  Nutzung
- 
 #   In der Burg ist ein Schatz versteckt, den es zu finden gilt! #   In der Burg ist ein Schatz versteckt, den es zu finden gilt!
- 
 # #
- 
 #  Befehle #  Befehle
- 
 #   • "Sesam, öffne dich!" #   • "Sesam, öffne dich!"
- 
 #   • "Sesam, schliesse dich!" #   • "Sesam, schliesse dich!"
- 
 # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
- 
  
 MIN_PADDING = 3         # Mindestabstand zwischen Räumen und Aussenwand MIN_PADDING = 3         # Mindestabstand zwischen Räumen und Aussenwand
- 
 SIMPLIFY = 0            # Burg vereinfachen um sie schneller zu generieren SIMPLIFY = 0            # Burg vereinfachen um sie schneller zu generieren
- 
 TOWERS = True           # Türme generieren TOWERS = True           # Türme generieren
- 
 T_RADIUS = 3            # Radius der Türme T_RADIUS = 3            # Radius der Türme
- 
 seed = 54321            # Startwert für Pseudozufallszahlen seed = 54321            # Startwert für Pseudozufallszahlen
- 
  
 # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
- 
 # Die Koordinaten im Code folgen der Einteilung von Minecraft, nach der y die # Die Koordinaten im Code folgen der Einteilung von Minecraft, nach der y die
- 
 # Höhe ist. # Höhe ist.
- 
 # Bei blocks.fill wurde FillOperation.REPLACE zwecks Leserlichkeit weggelassen, # Bei blocks.fill wurde FillOperation.REPLACE zwecks Leserlichkeit weggelassen,
- 
 # da es sich um den Standartwert handelt. # da es sich um den Standartwert handelt.
- 
 # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
- 
  
 CHUNK_HEIGHT = 6 # Festgelegt durch Höhe der Burgsegmente CHUNK_HEIGHT = 6 # Festgelegt durch Höhe der Burgsegmente
- 
 L = 0 L = 0
- 
 materials = [STONE_BRICKS, MOSSY_STONE_BRICKS, STONE_BRICK_STAIRS, STONE_BRICKS_SLAB, OXIDIZED_COPPER, CRACKED_STONE_BRICKS] materials = [STONE_BRICKS, MOSSY_STONE_BRICKS, STONE_BRICK_STAIRS, STONE_BRICKS_SLAB, OXIDIZED_COPPER, CRACKED_STONE_BRICKS]
- 
 start_pos = player.position() start_pos = player.position()
- 
  
 #----------------- #-----------------
- 
 # Hilfsfunktionen # Hilfsfunktionen
- 
 #----------------- #-----------------
- 
  
 # Relative Koordinaten unabhängig von der Bewegung des Spielers während der Ausführung # Relative Koordinaten unabhängig von der Bewegung des Spielers während der Ausführung
- 
 def position(x, y, z): def position(x, y, z):
- 
     return start_pos.add(positions.create(x, y, z))     return start_pos.add(positions.create(x, y, z))
-     
  
 # Funktion um Wert eine Position zu erhalten (da die Funktion position() mit .get_value() sonst nur Weltkoordinaten ausgibt) # Funktion um Wert eine Position zu erhalten (da die Funktion position() mit .get_value() sonst nur Weltkoordinaten ausgibt)
- 
 def get(pos: Position, axis): def get(pos: Position, axis):
- 
     return pos.to_world().get_value(axis) - start_pos.get_value(axis)     return pos.to_world().get_value(axis) - start_pos.get_value(axis)
-     
  
 # Pseudozufallszahlengenerator https://de.wikipedia.org/wiki/Kongruenzgenerator#Linearer_Kongruenzgenerator # Pseudozufallszahlengenerator https://de.wikipedia.org/wiki/Kongruenzgenerator#Linearer_Kongruenzgenerator
- 
 def lcg(value=0): def lcg(value=0):
- 
     global seed     global seed
-     
     a, c, m = 1664525, 1013904223, 2**32 # Werte aus https://www.columbia.edu/~ks20/4106-18-Fall/Simulation-LCG.pdf     a, c, m = 1664525, 1013904223, 2**32 # Werte aus https://www.columbia.edu/~ks20/4106-18-Fall/Simulation-LCG.pdf
-     
  
     if value == 0:     if value == 0:
-     
         seed = (seed * a + c) % m         seed = (seed * a + c) % m
-         
         return seed / m         return seed / m
-         
     else:     else:
-     
         return ((value * a + c ) % m) / m         return ((value * a + c ) % m) / m
-         
                  
 #----------------- #-----------------
- 
 # Burg # Burg
- 
 #----------------- #-----------------
- 
  
 # Funktion zum bauen der Segmente # Funktion zum bauen der Segmente
- 
 def chunk_builder(): def chunk_builder():
- 
     blocks.saveStructure("save", world(0, 200, 0), world(16, 250, 16), True)     blocks.saveStructure("save", world(0, 200, 0), world(16, 250, 16), True)
-     
  
     blocks.fill(AIR, world(0, 200, 0), world(16, 250, 16)) # Bereich leeren     blocks.fill(AIR, world(0, 200, 0), world(16, 250, 16)) # Bereich leeren
-     
  
     for i in range(2):     for i in range(2):
-     
         blocks.fill(materials[0], world(0, 200 + 5 * i, 0), world(16, 200 + 5 * i, 16))         blocks.fill(materials[0], world(0, 200 + 5 * i, 0), world(16, 200 + 5 * i, 16))
         blocks.fill(materials[0], world(0, 201, 16 * i), world(5 + i, 204, 16 * i))         blocks.fill(materials[0], world(0, 201, 16 * i), world(5 + i, 204, 16 * i))
Zeile 129: Zeile 83:
         blocks.fill(materials[0], world(0 + 11 * i, 200, 4), world(4 + 11 * i, 204, 4))         blocks.fill(materials[0], world(0 + 11 * i, 200, 4), world(4 + 11 * i, 204, 4))
         blocks.fill(materials[0], world(13 - i, 200 + 3 * i, 11), world(13 - i, 202 + 2 * i, 5))         blocks.fill(materials[0], world(13 - i, 200 + 3 * i, 11), world(13 - i, 202 + 2 * i, 5))
-         
                  
     blocks.fill(materials[0], world(11, 200, 12), world(15, 204, 12))     blocks.fill(materials[0], world(11, 200, 12), world(15, 204, 12))
Zeile 136: Zeile 89:
     blocks.fill(materials[0], world(4, 200, 12), world(4, 204, 12))     blocks.fill(materials[0], world(4, 200, 12), world(4, 204, 12))
     blocks.fill(materials[0], world(3, 200, 11), world(3, 204, 5))     blocks.fill(materials[0], world(3, 200, 11), world(3, 204, 5))
-     
  
     # Öffnungen für Durchgänge     # Öffnungen für Durchgänge
-     
     blocks.fill(AIR, world(0, 201, 7), world(0, 203, 8))     blocks.fill(AIR, world(0, 201, 7), world(0, 203, 8))
     blocks.fill(AIR, world(4, 201, 4), world(4, 202, 4))     blocks.fill(AIR, world(4, 201, 4), world(4, 202, 4))
Zeile 155: Zeile 106:
     blocks.fill(AIR, world(5, 205, 0), world(5, 205, 13))     blocks.fill(AIR, world(5, 205, 0), world(5, 205, 13))
     blocks.fill(AIR, world(10, 205, 3), world(10, 205, 16))     blocks.fill(AIR, world(10, 205, 3), world(10, 205, 16))
-     
  
     # Stufen zur Verschönerung der Durchgänge     # Stufen zur Verschönerung der Durchgänge
-     
     blocks.place(blocks.block_with_data(materials[2], 7), world(0, 203, 7))     blocks.place(blocks.block_with_data(materials[2], 7), world(0, 203, 7))
     blocks.place(blocks.block_with_data(materials[2], 6), world(0, 203, 8))     blocks.place(blocks.block_with_data(materials[2], 6), world(0, 203, 8))
- 
  
     blocks.place(blocks.block_with_data(materials[2], 5), world(2, 203, 16))     blocks.place(blocks.block_with_data(materials[2], 5), world(2, 203, 16))
     blocks.place(blocks.block_with_data(materials[2], 4), world(3, 203, 16))     blocks.place(blocks.block_with_data(materials[2], 4), world(3, 203, 16))
-     
          
     blocks.place(blocks.block_with_data(materials[2], 7), world(16, 203, 7))     blocks.place(blocks.block_with_data(materials[2], 7), world(16, 203, 7))
     blocks.place(blocks.block_with_data(materials[2], 6), world(16, 203, 9))     blocks.place(blocks.block_with_data(materials[2], 6), world(16, 203, 9))
-     
          
     blocks.fill(blocks.block_with_data(materials[2], 5), world(10, 204, 5), world(10, 204, 11))     blocks.fill(blocks.block_with_data(materials[2], 5), world(10, 204, 5), world(10, 204, 11))
     blocks.fill(blocks.block_with_data(materials[2], 4), world(5, 204, 5), world(5, 204, 11))     blocks.fill(blocks.block_with_data(materials[2], 4), world(5, 204, 5), world(5, 204, 11))
-     
  
     for x in range(16):     for x in range(16):
-     
         if x % 3 == 0:         if x % 3 == 0:
-         
             for z in range(16):             for z in range(16):
-             
                 if z % 3 == 0:                 if z % 3 == 0:
-                 
                     player.execute("/setblock " + x + " 205 " + z + " ochre_froglight")                     player.execute("/setblock " + x + " 205 " + z + " ochre_froglight")
                            
  
     # Treppen-Segment     # Treppen-Segment
-     
     blocks.fill(materials[1], world(0, 220, 0), world(16, 220, 16))     blocks.fill(materials[1], world(0, 220, 0), world(16, 220, 16))
     blocks.fill(AIR, world(3, 220, 3), world(13, 220, 13))     blocks.fill(AIR, world(3, 220, 3), world(13, 220, 13))
- 
  
     for step in range(2, 14):  # Treppenstufen erstellen     for step in range(2, 14):  # Treppenstufen erstellen
-     
         material = materials[3] if step % 2 == 0 else materials[0]         material = materials[3] if step % 2 == 0 else materials[0]
         blocks.fill(material, world(step + 1, 220 + (step // 2), 5), world(step + 1,  220 + (step // 2), 8))         blocks.fill(material, world(step + 1, 220 + (step // 2), 5), world(step + 1,  220 + (step // 2), 8))
-     
          
     # Speichern der Strukturen     # Speichern der Strukturen
-     
     blocks.saveStructure("chunk_default", world(0, 200, 0), world(16, 205, 16), True)     blocks.saveStructure("chunk_default", world(0, 200, 0), world(16, 205, 16), True)
     blocks.loadStructure("chunk_default", world(0, 210, 0))     blocks.loadStructure("chunk_default", world(0, 210, 0))
     blocks.saveStructure("chunk_staircase", world(0, 220, 0), world(16, 225, 16), True)     blocks.saveStructure("chunk_staircase", world(0, 220, 0), world(16, 225, 16), True)
- 
  
     blocks.place(IRON_BLOCK, world(1, 211, 1))     blocks.place(IRON_BLOCK, world(1, 211, 1))
Zeile 214: Zeile 149:
     blocks.place(DIAMOND_BLOCK, world(1, 211, 3))     blocks.place(DIAMOND_BLOCK, world(1, 211, 3))
     blocks.place(DIAMOND_BLOCK, world(1, 212, 3))     blocks.place(DIAMOND_BLOCK, world(1, 212, 3))
-     
  
     # Schatz-Segment speichern     # Schatz-Segment speichern
-     
     blocks.saveStructure("chunk_treasure", world(0, 210, 0), world(16, 215, 16), True)     blocks.saveStructure("chunk_treasure", world(0, 210, 0), world(16, 215, 16), True)
-     
  
     blocks.loadStructure("save", world(0, 200, 0))     blocks.loadStructure("save", world(0, 200, 0))
-     
     return 1     return 1
-     
  
  
 # Funktion zum Zusammensetzen der Segmente # Funktion zum Zusammensetzen der Segmente
- 
 def build_core(length, height, width, start_pos: Position): def build_core(length, height, width, start_pos: Position):
- 
     treasure = Math.round(lcg() * length * width * height)     treasure = Math.round(lcg() * length * width * height)
-     
     for x in range(length):     for x in range(length):
-     
         for y in range(height):         for y in range(height):
-         
             for z in range(width):             for z in range(width):
  
Zeile 254: Zeile 179:
                     if y == 0:                     if y == 0:
                         blocks.fill(materials[0], position(x_now, y_now, z_now), position(x_now + 16, y_now, z_now + 16)) # Öffnung zum Boden schliessen                         blocks.fill(materials[0], position(x_now, y_now, z_now), position(x_now + 16, y_now, z_now + 16)) # Öffnung zum Boden schliessen
-                    elif y == height - 1: 
-                        blocks.fill(AIR, position(x_now + 3, y_now + CHUNK_HEIGHT, z_now + 3), position(x_now + 13, y_now + CHUNK_HEIGHT, z_now + 13)) # Ausgang in Richtung Dach erzeugen 
  
  
Zeile 390: Zeile 313:
  
 main(54, 18, 38, position(0, 0, 0)) main(54, 18, 38, position(0, 0, 0))
 +</code>
  • gf2/projekte/2024/minecraft/2d2gruppe3.1744575750.txt.gz
  • Zuletzt geändert: 2025/04/13 22:22
  • von bluml