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 / 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
@horstjens
horstjens / character_chooser1.py
Created March 3, 2025 17:31
freesimplegui character chooser
import FreeSimpleGUI as sg
#sg.popup_ok("hallo")
database = {
"player": {
"name":"player",
"filename":"player1.png",
"attack":15,
"defense":21,
@horstjens
horstjens / cannon_lukas.py
Last active February 28, 2025 15:56
freesimplegui cannon game
import FreeSimpleGUI as sg
import math
import random
col_player_1_r=sg.Column(layout=[
[sg.Multiline(default_text="history:\n",
autoscroll=True,
key="history",
disabled=True,
size=(50,10))]
@horstjens
horstjens / freesimplegui_cannon.py
Last active February 21, 2025 15:22
kanone mit freesimplegui
import FreeSimpleGUI as sg
import math
import random
col_rechts=sg.Column(layout=[
[sg.Multiline(default_text="history:\n",
autoscroll=True,
key="history",
disabled=True,
size=(50,10))]