This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mcpi.minecraft import Minecraft # Import the Minecraft module | |
from mcpi import block # Import block definitions | |
# Connect to the Minecraft game | |
mc = Minecraft.create() | |
# Get the player’s current position | |
x0, y0, z0 = mc.player.getTilePos() | |
# Define the opposite corner of the area to flatten (50x50 square) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk # Import the Tkinter library for GUI | |
# Create the main window | |
window = tk.Tk() # Create the main application window | |
window.title("Hello App") # Set the window title | |
window.geometry("300x220") # Set the window size | |
# Default theme | |
theme = "light" # Start in light mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We import the library we need to run our program | |
from mcpi.minecraft import Minecraft | |
# We create a connection to our minecraft world | |
mc = Minecraft.create() | |
#We get our position in the world | |
x, y, z = mc.player.getTilePos() | |
# We set a redstone block as a marker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include standard libraries | |
#include <stdio.h> // for printf() and scanf() | |
#include <stdlib.h> // for rand() and srand() | |
#include <time.h> // for time(), to seed the random number generator | |
int main() { | |
// Declare variables | |
int number; // The number the computer randomly selects | |
int guess; // The player's current guess | |
int tries = 0; // Counter to track how many guesses the player has made |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import required libraries | |
from mcpi.minecraft import Minecraft # Main Minecraft Pi interface | |
from mcpi import block # Provides block types/IDs | |
import time # For adding delays | |
# Create connection to Minecraft game | |
mc = Minecraft.create() | |
# Get the player's current position coordinates (x, y, z) | |
x, y, z = mc.player.getTilePos() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyautogui # Library for controlling mouse and keyboard | |
import time # Library for delays and timing | |
print("Starting auto clicker in 5 seconds. Press Ctrl+C to stop.") | |
time.sleep(5) # Give the user 5 seconds to switch to the desired window | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the libraries we need | |
from mcpi.minecraft import Minecraft | |
# Create a connection to our game | |
mc = Minecraft.create() | |
# We get out position in the world | |
x, y, z = mc.player.getTilePos() | |
# We build our Tree trunk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the Minecraft API module to interact with Minecraft | |
from mcpi.minecraft import Minecraft | |
# Create a connection to the Minecraft game | |
mc = Minecraft.create() | |
# Import the time module to add delays | |
import time | |
# Initialize a counter variable to keep track of iterations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the Minecraft API module to interact with the Minecraft game | |
from mcpi.minecraft import Minecraft | |
# Create a connection to the Minecraft game (assumes Minecraft is running with the Python API enabled) | |
mc = Minecraft.create() | |
# Send a message to the Minecraft in-game chat | |
mc.postToChat("Minecraft is better than Fortnite") | |
# Get the current coordinates (x, y, z) of the player in the Minecraft world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame # Import the Pygame library for game development | |
pygame.init() # Initialize all Pygame modules | |
# Constants | |
WIDTH, HEIGHT = 800, 400 # Dimensions of the game window | |
WHITE = (255, 255, 255) # RGB color code for white | |
BLUE = (0, 150, 255) # RGB color code for blue (player color) | |
RED = (255, 50, 50) # RGB color code for red (obstacle color) | |
BLACK = (0, 0, 0) # RGB color code for black |
NewerOlder