Skip to content

Instantly share code, notes, and snippets.

View TheVoxcraft's full-sized avatar

Jonas TheVoxcraft

  • University i Oslo (USIT)
View GitHub Profile
@TheVoxcraft
TheVoxcraft / SuperGGPaint.py
Created December 16, 2014 06:50
A Windows Paint Remake (Simple). UP/DOWN Arrow to adjust brush size. BACKSPACE to erase everything.
import pygame
#Initialization
pygame.init()
print("> SuperGGPaint Debug Console")
print("")
#Defining colors
white = (255,255,255)
@TheVoxcraft
TheVoxcraft / slither.py
Last active August 29, 2015 14:11
My first snake game in pygame. Requires pygame 3.4 module.
import pygame
import random
#Initialization
pygame.init()
print("> Snake Debug Console")
print("")
#Defining colors
white = (255,255,255)
@TheVoxcraft
TheVoxcraft / client.py
Created December 5, 2014 08:14
Improved One way message redux using sockets.
import socket # Import socket module
host = raw_input("Host IP: ") # Get local machine name
port = 12345 # Reserve a port for your service.
while True:
s = socket.socket() # Create a socket object
s.connect((host, port))
print s.recv(1024)
@TheVoxcraft
TheVoxcraft / terrain - v2.py
Last active August 29, 2015 14:10
ASCII Terrain Generation Version 2.0 Advanced. Made by VOX
#Made by VOX, on gist. (TheVoxcraft)
#Still has a few bugs.
#Python 2.7
print("Loading...\n\n")
import random
line1=""
line2=""
line3=""
@TheVoxcraft
TheVoxcraft / chat_room_client.py
Created December 3, 2014 12:15
Old Complex Chat room.
# telnet program example
import socket, select, string, sys
def prompt() :
sys.stdout.write('<You> ')
sys.stdout.flush()
#main function
if __name__ == "__main__":
@TheVoxcraft
TheVoxcraft / email_CONTENT.txt
Created December 3, 2014 12:14
Email Sender/Handler. No email code.
Your email content here.
@TheVoxcraft
TheVoxcraft / divide.py
Created December 3, 2014 12:12
Divides words.
#letter dividing
canRun=1
while canRun == 1:
word=raw_input("Type in a word: ")
for letter in word:
print("Current letter: " + letter)
print(" ")
@TheVoxcraft
TheVoxcraft / guess_it.py
Last active August 29, 2015 14:10
2 Player Guessing Game. The player nearest to random number wins. Local
import random
#To do: Make it multiplayer LAN version!
print("\n"*50)
print("Welcome to guess the it!")
print("")
print("")
player1name=raw_input("Enter your name player 1: ")
@TheVoxcraft
TheVoxcraft / ntsng v2.py
Created December 3, 2014 12:09
Never the same number generator. VERSION 2
import random as rnd
nu=0
try:
with open("DATA.txt", 'r') as f:
c = [line.rstrip('\n') for line in f]
print "LOADED!"
except IOError:
print "Setting up!"
with open("DATA.txt", 'w') as f:
@TheVoxcraft
TheVoxcraft / RPG.py
Created December 3, 2014 12:08
Simple RPG in python
from random import randint
class Character:
def __init__(self):
self.name = ""
self.health = 1
self.health_max = 1
def do_damage(self, enemy):
damage = min(
max(randint(0, self.health) - randint(0, enemy.health), 0),