This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tic tac toe spiel für 2 spieler, eingabekontrolle | |
# sieg ermittlung | |
# Horst JENS, 2024 08 | |
def gewonnen(): | |
feld = spielfeld.replace("-+-+-\n","") | |
feld = feld.replace("|","") | |
feld = feld.replace("\n","") | |
print(feld) | |
# 012 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FreeSimpleGUI as sg | |
import random | |
import matplotlib | |
matplotlib.use('TkAgg') | |
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg | |
#import numpy as np | |
import matplotlib.pyplot as plt | |
# format mini language https://docs.python.org/3/library/string.html#formatspec | |
class Pokemon: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Matplotlib_Browser.py | |
# !/usr/bin/env python | |
import FreeSimpleGUI as sg | |
import matplotlib | |
matplotlib.use('TkAgg') | |
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg | |
import numpy as np | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FreeSimpleGUI as sg | |
import FreeSimpleGUI as sg | |
# Define the window's contents | |
c_left = sg.Column(layout=[ | |
[sg.Text("erste Zeile links1")], | |
[sg.Text("beginn links2")], | |
[sg.Text("links3")], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# battle between 2 pokemons | |
import random | |
class Pokemon: | |
def __init__(self, name): | |
self.name = name | |
self.hp_full = 100 | |
self.hp = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
W, H = 2000, 1000 | |
turtle.setup(W,H) | |
screen = turtle.Screen() | |
screen.setworldcoordinates(0,0,W,H) | |
screen.tracer(0) | |
# create turtles | |
for i in range(50): | |
t = turtle.Turtle() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# friction, acceleartion and drifting | |
import pygame | |
import random | |
W, H = 1280, 720 | |
class TextSprite(pygame.sprite.DirtySprite): | |
def __init__(self, pos, color, textsize, text, age_max ): | |
self.dirty = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import os | |
# Example file showing a circle moving on screen | |
W,H = 1280, 720 | |
FPS = 60 | |
APS = 4 # animations per second | |
# pygame setup | |
pygame.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import vpython as vp | |
class Game: | |
scene = vp.canvas(width=1024, | |
height=600, | |
title="linus rogue") | |
fps = 30 | |
dt = 1/fps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vpython as vp | |
vp.arrow(axis=vp.vec(1,0,0), | |
color=vp.color.red) | |
vp.arrow(axis=vp.vec(0,1,0), | |
color=vp.color.green) | |
vp.arrow(axis=vp.vec(0,0,1), | |
color=vp.color.blue) | |
vp.label(text="x", pos=vp.vec(1.1,0,0)) | |
vp.label(text="y", pos=vp.vec(0,1.1,0)) |
NewerOlder