Skip to content

Instantly share code, notes, and snippets.

View horstjens's full-sized avatar
💭
teaching python/pygame to children

Horst JENS horstjens

💭
teaching python/pygame to children
View GitHub Profile
@horstjens
horstjens / viergewinnt4.py
Last active December 23, 2023 09:43
viergewinnt pysimplegui
import random
import PySimpleGUI as sg
spieler = 1
summe = 0
rows = 6 # max. 26
cols = 7 # max. 26
gewinnt = 4
@horstjens
horstjens / viergewinnt2.py
Last active November 25, 2023 09:19
vier gewinnt
import random
spieler = 1
summe = 0
rows = 6 # max. 25
cols = 17 # max. 25
gewinnt = 5
spielzug = 0
#feld = [
# [0,0,0,0,0,0,0],
# [0,0,0,0,0,0,0],
@horstjens
horstjens / wallsurfer1.py
Created October 29, 2023 07:54
vo wallsurfer
# gist.github.com/horstjens
import vpython as vp
import random
class Game:
scene = vp.canvas(width=1200, height=650, title="wall surfer")
dt = 0.1
xlimit = 20
@horstjens
horstjens / drunk_turtle_race7.py
Created October 28, 2023 14:15
drunk turtle race
import turtle
import random
w,h = 1200,750
turtle.setup(w,h)
colors = ["blue","red","green","yellow"]
goals = []
stable = []
y = h//2
# gist.github.com/horstjens
import vpython as vp
import random
class Game:
dt = 0.1
xlimit = 20
ylimit = 10
@horstjens
horstjens / astar.py
Last active September 15, 2023 09:00 — forked from ryancollingwood/astar.py
# Credit for this: Nicholas Swift
# as found at https://medium.com/@nicholas.w.swift/easy-a-star-pathfinding-7e6689c7f7b2
from warnings import warn
import heapq
class Node:
"""
A node class for A* Pathfinding
"""
@horstjens
horstjens / vpballs.py
Created August 25, 2023 09:51
vp balls
import random
import vpython as vp
class Game:
size = 20
class Ball(vp.sphere):
def __init__(self):
p = vp.vector(random.uniform(0, Game.size),
random.uniform(0, Game.size),
import vpython as vp
import random
class Game:
player1 = None
player2 = None
fps = 30 # frames per second
dt = 1/fps # delta time in seconds
board_size = 10
player_speed = 2
@horstjens
horstjens / vpython_catcher001.py
Created August 24, 2023 07:03
lara_max_alexander
import vpython as vp
import random
class Game:
fps = 30 # frames per second
dt = 1/fps # delta time in seconds
board_size = 10
player_speed = 2
max_balls = 3
gravity = -0.2
import random
from dice2 import diceroll
class Monster:
def __init__(self, name):
self.name = name
self.hp = 10
self.attack = 0.7
self.defense = 0.5