Skip to content

Instantly share code, notes, and snippets.

View greggraham's full-sized avatar

Greg Graham greggraham

  • Cistercian Preparatory School
  • Coppell, TX
View GitHub Profile
@greggraham
greggraham / adventure.py
Created March 28, 2020 17:32
Adventure Game
# Adventure, by Mr. Graham
def choose(message, choices):
"""Get a choice from the player."""
print("\n" + message)
keys = []
for (key, choice) in choices:
print(" {}: {}".format(key, choice))
keys.append(key)
@greggraham
greggraham / objinvaders04.py
Created November 21, 2019 21:03
The conclusion of the space invaders exercise
"""This is a simple Space Invaders game for learning PyGame Zero
and Object Oriented programming."""
### CONSTANTS ###
WIDTH = 639
HEIGHT = 426
### CLASS DEFINITIONS ###
@greggraham
greggraham / objinvaders01.py
Last active November 19, 2019 21:05
Invaders using classes part 1
"""This is a simple Space Invaders game for learning PyGame Zero
and Object Oriented programming."""
### CONSTANTS ###
WIDTH = 639
HEIGHT = 426
### CLASS DEFINITIONS ###
@greggraham
greggraham / honeycomb.py
Last active November 18, 2019 14:34
This program illustrates how to create a simple honeycomb tessellation using Turtle Graphics.
# This program illustrates how to create a simple tessellation using Turtle Graphics.
# Taken from The honeycomb challenge - www.101computing.net/honeycomb-challenge/
import turtle
import math
# Draw a hexagon at a given (x,y) position.
def draw_hexagon(ttl, x, y, edgeLength):
ttl.penup()
ttl.goto(x, y)
ttl.pendown()
@greggraham
greggraham / s_log.txt
Created September 14, 2018 18:19
Mu Editor log file for bug report
2018-09-14 09:24:46,327 - root:111(run) INFO:
-----------------
Starting Mu 1.0.0.beta.16
2018-09-14 09:24:46,327 - root:112(run) INFO: uname_result(system='Windows', node='LLab09', release='10', version='10.0.17134', machine='AMD64', processor='Intel64 Family 6 Model 60 Stepping 3, GenuineIntel')
2018-09-14 09:24:46,327 - root:113(run) INFO: Python path: ['C:\\Program Files\\Mu\\pkgs', 'C:\\Program Files\\Mu\\Python\\python36.zip', 'C:\\Program Files\\Mu\\Python', 'C:\\Program Files\\Mu\\pkgs', 'C:\\Program Files\\Mu\\pkgs\\IPython\\extensions']
2018-09-14 09:24:46,436 - mu.logic:542(__init__) INFO: Setting up editor.
2018-09-14 09:24:46,436 - mu.logic:556(__init__) INFO: Settings path: C:\Users\formii\AppData\Local\python\mu\settings.json
2018-09-14 09:24:46,436 - mu.logic:557(__init__) INFO: Session path: C:\Users\formii\AppData\Local\python\mu\session.json
@greggraham
greggraham / y_log.txt
Created September 14, 2018 18:15
Mu Editor log file for bug report
2018-09-14 09:24:11,774 - root:111(run) INFO:
-----------------
Starting Mu 1.0.0.beta.16
2018-09-14 09:24:11,774 - root:112(run) INFO: uname_result(system='Windows', node='LLab08', release='10', version='10.0.17134', machine='AMD64', processor='Intel64 Family 6 Model 60 Stepping 3, GenuineIntel')
2018-09-14 09:24:11,774 - root:113(run) INFO: Python path: ['C:\\Program Files\\Mu\\pkgs', 'C:\\Program Files\\Mu\\Python\\python36.zip', 'C:\\Program Files\\Mu\\Python', 'C:\\Program Files\\Mu\\pkgs', 'C:\\Program Files\\Mu\\pkgs\\IPython\\extensions']
2018-09-14 09:24:11,883 - mu.logic:542(__init__) INFO: Setting up editor.
2018-09-14 09:24:11,883 - mu.logic:556(__init__) INFO: Settings path: C:\Users\formii\AppData\Local\python\mu\settings.json
2018-09-14 09:24:11,883 - mu.logic:557(__init__) INFO: Session path: C:\Users\formii\AppData\Local\python\mu\session.json
@greggraham
greggraham / sd-cards.md
Last active May 26, 2017 18:32 — forked from gbaman/sd-cards.md
How to clone an SD card for use in a classroom

Creating SD card clones for classrooms

The basic idea for creating SD cards in a classroom is you create a master SD card, make all the required changes (install software, edit configuration files etc), then read it back onto the computer and flash it onto the rest of your SD cards like a normal Raspbian SD card image.

Shameless plug

If you have a networked classroom or are able to set one up, my free and open-source Raspi-LTSP project will save you a lot of time and hastle!

A few key tips

  1. Be careful what size of SD card you use! As you will be cloning the entire SD card (even blank areas) it is important you create the master image with your smallest SD card. For example, if you are using 8gb cards that are all exactly the same make and model, it shouldn't be much of a problem. The issue is different manufacturers when they create an 8gb sd card, it may be a few kilobytes bigger than that other brands 8gb SD card. So if you use the bigger one to
@greggraham
greggraham / game3.rkt
Created December 2, 2015 03:18
This version adds multiple enemies
#lang racket
(require 2htdp/universe 2htdp/image rackunit)
; Data Definition
; An Estate is the state of an enemy, containing it's X and Y coordinates.
(struct estate (x y) #:transparent)
; A Wstate is a structure containing the world state of the game,
; and includes the following elements:
; - the X and Y coordinates of the player
@greggraham
greggraham / game2.rkt
Created December 1, 2015 18:32
A little more of a simple game.
#lang racket
(require 2htdp/universe 2htdp/image rackunit)
; Constants
(define WIDTH 800)
(define HEIGHT 600)
(define PLAYER-SPEED 5)
(define PLAYER (circle 10 "solid" "blue"))
(define ENEMY (rotate 270 (triangle 50 "solid" "red")))
(define ENEMY-SPEED 15)
@greggraham
greggraham / game1.rkt
Created December 1, 2015 18:29
A very simple beginning of a game in Racket.
#lang racket
(require 2htdp/universe 2htdp/image rackunit)
; Constants
(define WIDTH 800)
(define HEIGHT 600)
(define PLAYER-SPEED 5)
(define PLAYER (circle 10 "solid" "blue"))