Skip to content

Instantly share code, notes, and snippets.

View coughlanweb's full-sized avatar

Ciarán Coughlan coughlanweb

View GitHub Profile
@coughlanweb
coughlanweb / flat.py
Last active July 21, 2025 10:40
create a flat world in minecraft pi edition
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)
@coughlanweb
coughlanweb / welcome.py
Created July 21, 2025 10:22
Gui welcome app
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
# 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
@coughlanweb
coughlanweb / guess.c
Created July 20, 2025 22:47
A simple Guessing game using the c language
// 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
@coughlanweb
coughlanweb / digbot.py
Created July 8, 2025 14:41
Make a digging bot in minecraft pi edition
# 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()
@coughlanweb
coughlanweb / clicker.py
Created July 7, 2025 20:26
Python Auto-Clicker
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:
@coughlanweb
coughlanweb / growtree.py
Created July 7, 2025 20:24
Grow a tree in Minecraft Pi edition
# 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
@coughlanweb
coughlanweb / watercurse.py
Last active June 4, 2025 20:30
Water Curse scripts for Minecraft Pi
# 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
@coughlanweb
coughlanweb / tnt.py
Created May 12, 2025 20:41
A simple python program to build a big block of TNT in minecraft
# 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
@coughlanweb
coughlanweb / jump.py
Created March 30, 2025 20:31
The complete Dino Jump code with background image and flipping mechanics
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