Skip to content

Instantly share code, notes, and snippets.

View pzp1997's full-sized avatar

Palmer Paul pzp1997

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="styles.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="main.js"></script>
for (Projectile bullet : bullets) {
for (Asteroid asteroid : asteroids) {
if ((bullet.x - asteroid.x) < (bullet.w + asteroid.w)/2 &&
(bullet.y - asteroid.y) < (bullet.h + asteroid.h)/2) {
for (int k = 20; k > -1; k--) {
asteroid.w = k;
asteroid.h = k;
asteroid.display();
}
@pzp1997
pzp1997 / TicTacToe.py
Created November 18, 2015 02:35
A text based Tic-Tac-Toe game in Python. This was one of my first programming projects; in hindsight it was coded absolutely horribly. I guess that makes it a good indicator of how much progress I've made since I started programming!
##Tic-Tac-Toe Game by Palmer Paul
print("Welcome to Tic-Tac-Toe!")
print()
stats = {"p1wins": 0, "p2wins": 0, "ties": 0}
def tictactoe(a):
board_label = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
board = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
@pzp1997
pzp1997 / TildeReverse.py
Last active September 27, 2015 20:01
Quickly reverse an iterable using the bitwise not operator (aka tilde).
def reverse(it):
arr = list(it)
for i in xrange(len(arr)//2):
arr[i], arr[~i] = arr[~i], arr[i]
return arr
def reverseGen(it):
arr = list(it)
for i in xrange(len(arr)):
yield arr[~i]
oceans = [[], [], [], [], []]
def RegTemp(regcode):
oceans[regcode-1].append((int(input("Digite la temperatura: ")), input("Digite la fecha: ")))
Mayor = lambda regcode: max(i[0] for i in oceans[regcode-1])
@pzp1997
pzp1997 / LoggerDecorator.py
Created August 10, 2015 19:28
Decorator that logs the input and output of a function. Useful for debugging.
#!/usr/bin/env python2.7
"""
Decorator that logs the input and output of a function. Useful for debugging.
"""
from functools import wraps
__author__ = 'Palmer Paul'
__version__ = '1.0.0'
@pzp1997
pzp1997 / ButtonHoldLights.ino
Created August 4, 2015 17:05
Created in 15 minutes during the "Last Night of Bimesis" Hackathon. Hold down the button, and the LEDs will light up sequentially; let go, and they will turn off in the reverse order. (Just try it out to see how it works.)
int ledPins[] = { 9, 10, 11, 12, 13 };
int btnPin = 8;
int curLed = 0;
int numOfLeds = sizeof(ledPins)/sizeof(int);
void setup() {
for (int i = 0; i < numOfLeds; i++) {
pinMode(ledPins[i], OUTPUT);
}
pinMode(btnPin, INPUT);
#!/usr/bin/env python2.7
from __future__ import print_function
"""Practice with Matrices"""
# Create our Matrix
matrix = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
@pzp1997
pzp1997 / processing-mobile.html
Last active August 29, 2015 14:21
HTML Template for processing-mobile.js
<!DOCTYPE html>
<html>
<head>
<title>
<!-- NAME OF YOUR PROCESSING SKETCH GOES HERE -->
</title>
<style type="text/css">
body { margin: 0 }
#!/usr/bin/env python2.7
"""Vigenere Cipher"""
from string import ascii_uppercase as alphabet
__author__ = 'Palmer (pzp1997)'
__version__ = '1.0.0'
__email__ = 'pzpaul2002@yahoo.com'