Skip to content

Commit ad94a16

Browse files
committed
Delete crawl_output.csv and makecodeperformance.csv
1 parent 181fbba commit ad94a16

File tree

3 files changed

+64
-9
lines changed

3 files changed

+64
-9
lines changed

crawl_output.csv

Whitespace-only changes.

makecodeperformance.csv

-9
This file was deleted.

pyramid/pyramid2.py

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Pyramid Builder for MakeCode Python
2+
# @JustinEducation
3+
# 21 Feb 2023
4+
5+
# Set gameplay
6+
gameplay.set_weather(CLEAR)
7+
gameplay.time_set(DayTime.DAY)
8+
gameplay.set_game_mode(CREATIVE, mobs.players_in_game_mode(CREATIVE))
9+
10+
# Set global variables
11+
playerX = 0
12+
playerY = 0
13+
playerZ = 0
14+
15+
def on_chat():
16+
17+
# Capture player position
18+
player_pos = player.position()
19+
playerX = player_pos.get_value(Axis.X)
20+
playerY = player_pos.get_value(Axis.Y)
21+
playerZ = player_pos.get_value(Axis.Z)
22+
23+
# Randomize pyramid size
24+
base_size = randint(4, 40)
25+
26+
# Calculate height of build based on base size
27+
height = (base_size // 2) + 1 if base_size % 2 == 0 else base_size // 2
28+
29+
# Position the agent and give resources
30+
set_agent()
31+
32+
# Build
33+
for index in range(height):
34+
for _ in range(4):
35+
for _ in range(base_size):
36+
if agent.detect(AgentDetection.BLOCK, FORWARD):
37+
agent.destroy(FORWARD)
38+
agent.move(FORWARD, 1)
39+
agent.place(BACK)
40+
agent.turn(TurnDirection.LEFT)
41+
agent.move(UP, 1)
42+
agent.place(DOWN)
43+
agent.move(LEFT, 1)
44+
agent.move(FORWARD, 1)
45+
46+
if agent.get_item_count(SANDSTONE) < 32:
47+
populate_agent()
48+
49+
base_size -= 2
50+
51+
# Function to set position of agent and give resource
52+
def set_agent():
53+
start_position = pos(playerX + 10, playerY, playerZ)
54+
agent.teleport(start_position, WEST)
55+
populate_agent()
56+
57+
# Function to give agent resources
58+
def populate_agent():
59+
agent.set_slot(1)
60+
agent.drop_all(FORWARD)
61+
agent.set_item(SANDSTONE, 64, 1)
62+
63+
# Call pyramid build function
64+
player.on_chat("pyramid", on_chat)

0 commit comments

Comments
 (0)