Skip to content

Instantly share code, notes, and snippets.

View GuyCarver's full-sized avatar

Guy Carver GuyCarver

  • Bethesda Game Studios
  • Maryland
View GitHub Profile
@GuyCarver
GuyCarver / mines.py
Created October 20, 2012 00:37
Pythonista mines game
from scene import *
import random
import console
from functools import partial
from sound import load_effect, play_effect
rows = 24
cols = 20
fsize = 20
plot_size = 32
@GuyCarver
GuyCarver / mazecraze.py
Last active July 12, 2019 19:02
Updated to new ui for options screen.
#----------------------------------------------------------------------
# Copyright (c) 2012, Guy Carver
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
@GuyCarver
GuyCarver / ripoff.py
Created November 20, 2012 03:29
Pythonista version of vector graphics ripoff arcade game.
#----------------------------------------------------------------------
# Copyright (c) 2012, Guy Carver
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
@GuyCarver
GuyCarver / monkey.py
Created November 20, 2012 05:07
Pythonista Frogger style game
#----------------------------------------------------------------------
# Copyright (c) 2012, Guy Carver
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
@GuyCarver
GuyCarver / image2base64.py
Created November 22, 2012 20:23
Pythonista image2base64
#covert an image in the clipboard to a 57x57 rgb icon and store base64 version of it into the clipboard.
#if an image is not in the clipboard the base64 string 'b64str' will be loaded and displayed.
#after running the 1st time replace the contents of b64str with the clipboard.
from PIL import Image
import clipboard
from StringIO import *
import base64
b64str="""
@GuyCarver
GuyCarver / tank.py
Created November 24, 2012 21:57
Pythonista tank (without a game)
#Pythonista
# remote controlled tank without a game. Haven't figured out the gameplay yet.
# Use remote app https://gist.github.com/959c9fba8e1e0c04f898 to control the tank.
# Work in progress.
from time import clock
from scene import *
from sound import *
from struct import *
@GuyCarver
GuyCarver / Tankremote.py
Created November 25, 2012 09:00
Pythonista Remote Control for Pythonista Tank
#Pythonista
#For use with the rc tank in https://gist.github.com/4141545
#I run this on my iPhone to control the tank on my iPad.
from scene import *
from sound import *
from socket import *
from struct import *
@GuyCarver
GuyCarver / comments.py
Created November 25, 2012 10:24
Pythonista editor script to toggle comment of selected lines.
#Comment/Uncomment selected lines.
import editor
text = editor.get_text()
selection = editor.get_line_selection()
selected_text = text[selection[0]:selection[1]]
is_comment = selected_text.strip().startswith('#')
replacement = ''
for line in selected_text.splitlines():
@GuyCarver
GuyCarver / indent.py
Created November 25, 2012 10:27
Pythonista editor script to indent selected lines.
#indent selection
import editor
text = editor.get_text()
selection = editor.get_line_selection()
selected_text = text[selection[0]:selection[1]]
replacement = ''
for line in selected_text.splitlines():
replacement += '\t' + line + '\n'
@GuyCarver
GuyCarver / unindent.py
Created November 25, 2012 10:28
Pythonista editor script to unindent selected lines.
#unindent selection
import editor
text = editor.get_text()
selection = editor.get_line_selection()
selected_text = text[selection[0]:selection[1]]
replacement = ''
for line in selected_text.splitlines():
replacement += line[line.find('\t') + 1:] + '\n'