Skip to content

Instantly share code, notes, and snippets.

View topherPedersen's full-sized avatar
💭
Rolling my katamari ball

Christopher Pedersen topherPedersen

💭
Rolling my katamari ball
View GitHub Profile
@topherPedersen
topherPedersen / RockScissorsPaper.py
Created August 16, 2018 17:06
The Game of Rock, Scissors, Paper as published in David Ahl's Basic Computer Games from 1978, rewritten in Python
import random
print("GAME OF ROCK, SCISSORS, PAPER")
print("CREATIVE COMPUTING")
print("MORISSTOWN, NEW JERSEY")
print("")
numberOfGames = 0
while numberOfGames <= 0 or numberOfGames >= 10:
numberOfGames = raw_input("HOW MANY GAMES?")
@topherPedersen
topherPedersen / TurtleGraphicsTemplate.py
Created August 16, 2018 22:30
Turtle Graphics Template (for use with the Trinket.io web based Python environment)
# This Template is intended for use with the Trinket.io web based
# programming environment. Modification may be needed for use with
# standard python interpreters on Windows, Mac, and Linux machines.
# Import the Turtle 2D Graphics Module
import turtle
# Create Game Window
screen = turtle.Screen()
screen.setup(500, 500)
@topherPedersen
topherPedersen / TkinterTurtleTemplate.py
Created August 17, 2018 00:50
Tkinter/Turtle Graphics 2D Game Template
# Import the Tkinter & Turtle Graphics Modules
import Tkinter
import turtle
# Create Game Window
screen = turtle.Screen()
screen.screensize(500, 500, "black")
# Create Sprite
screen.addshape("sprite.gif")
@topherPedersen
topherPedersen / ROCKSP.swift
Created September 5, 2018 21:08
Rock, Scissors, Paper (Swift Edition)
// This gist demonstrates how to create a Rock, Paper, Scissors game in iOS using swift.
// The "GAME OF ROCK, SCISSORS, PAPER" was originally published in David Ahl's
// "Basic Computer Games" back in 1978. "Basic Computer Games" was comprised of 101
// computer games written in the BASIC programming language and was often used
// by beginner programmers as a means of learning to code. Therefore, I've named
// my iOS app written in Swift "Rock, Scissors, Paper" instead of "Rock, Paper, Scissors"
// in honor of Ahl's book.
// Note that this is a simple single view app with one ViewController. The view contains
// a few static labels which do not change, and three buttons: ROCK, SCISSORS, PAPER.
@topherPedersen
topherPedersen / oop_turtle.py
Created September 5, 2018 23:37
Object Oriented Tkinter/Turtle Graphics Template for 2D Python Games
# Import the Tkinter & Turtle Graphics Modules
import Tkinter
import turtle
# Create Game Window
screen = turtle.Screen()
screen.screensize(500, 500, "black")
# Create Sprite Object Which Inherits from Turtle
@topherPedersen
topherPedersen / tictactoe.py
Created September 15, 2018 20:04
TicTacToeByGrace.py
# Tic Tac Toe assignmen that my student Grace is working on.
# Saving here until she creates a github account.
# Shruthi & Grace, Make Me Tic-Tac-Toe!
# if you need to use random numbers....
# import random
# randomNumber = random.randint(1, 10)
# To print text on the screen: print("text goes here")
@topherPedersen
topherPedersen / nl2p.php
Created September 20, 2018 06:14
Replace Newline (\n) Characters with Paragraph Tags (<p>): Critical Utility for Blogging Software
<?php
// nl2p function by Anderson: https://www.guruqa.com/topic.php?t=6527
function nl2p($string, $line_breaks = true, $xml = true) {
$string = str_replace(array('<p>', '</p>', '<br>', '<br />'), '', $string);
// It is conceivable that people might still want single line-breaks
// without breaking into a new paragraph.
if ($line_breaks == true) {
return '<p>'.preg_replace(array("/([\n]{2,})/i", "/([^>])\n([^<])/i"), array("</p>\n<p>", '$1<br'.($xml == true ? ' /' : '').'>$2'), trim($string)).'</p>';
} else {
@topherPedersen
topherPedersen / uselessweb.html
Created September 25, 2018 23:58
TheUselessWeb.com Starter Template
<!DOCTYPE html>
<html>
<body>
<img src="crazymuppet.jpg">
<button id="play-btn" onClick="playAudio();">PLAY</button>
<script>
var laugh = new Audio("laugh.mp3");
function playAudio() {
@topherPedersen
topherPedersen / helloworld.a
Created September 26, 2018 02:27
"hello, world" in 6502 Assembly Language for the Atari 2600 (Code Example from "Making Games for the Atari 2600" by Steven Hugg)
processor 6502
include "vcs.h"
include "macro.h"
seg Code
org $f000 ; start code at $f000
Start sei ; disable interrupts
cld ; disable BCD math mode
@topherPedersen
topherPedersen / blankPygameTrinketLink.txt
Created September 26, 2018 21:07
Blank Pygame Trinket Link