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
import random
class Monster:
"""
a generic monste class for everyone
in the dugeon, inlclding the player!
"""
zoo = {} # number:<class instance>
number = 0
# lukas rogue 001
level_0 = """
###################################################
#.................................................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
@horstjens
horstjens / turtlestarwars004.py
Last active August 8, 2025 09:40
turtle star wars
import turtle
import random
import time
rebels = []
imperials = []
laser = []
tasten = []
@horstjens
horstjens / vier_gewinnt.py
Last active July 4, 2025 08:58
vier_gewinnt
# vier gewinnt
def frage_nach_spalte(erlaubte_spalten, erlaube_q=True):
"""
:param erlaubte_spalten: z.B. [0,1,2,4,6]
:param erlaube_q: True oder False
:return: None (für quit) oder index der gewünschten Spalte
"""
while True:
if erlaube_q:
@horstjens
horstjens / tictactoe001.py
Last active July 3, 2025 07:37
tictactoe
# tic tac toe
# done: maximal 9 spielzüge
# done: besetzes Feld soll nicht mehr spielbar sein
# done: gewinnermittlung
def hat_jemand_gewonnen(spieler):
"""
kontrolliert die liste felder, ob ein das zeichen
namens 'spieler' 3 x nebeneinander (horizontal,
@horstjens
horstjens / paul5.py
Last active July 2, 2025 08:16
paul zahlenraten 5
import time
import random
class Game:
untergrenze = 1
obergrenze = 100
def frage_nach_zahl(prompt="Bitte Zahl eingeben",
untergrenze = 1,
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
#
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base85 encoding of a zip file, this zip file contains
# an entire copy of pip (version 25.1.1).
#
# Pip is a thing that installs packages, pip itself is a package that someone
@horstjens
horstjens / zahlenraten_paul4.py
Last active July 1, 2025 08:33
zahlenraten_paul
import time
import random
class Game:
untergrenze = 1
obergrenze = 100
def hauptmenü():
print("------------------------------------")
print("------- zahlenratenspiel -----------")
import random
class Monster:
# class variables
number = 0
zoo = {}
def __init__(self, **kwargs):
self.number = Monster.number
Monster.number += 1
@horstjens
horstjens / client1.py
Last active March 21, 2025 14:30
chat
import socket
def start_client():
# Create a socket object
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('localhost', 12345))
print("Connected to server.")
while True:
# Send a message to the server