diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-11-23 12:18:04 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-11-23 12:18:04 +0100 |
| commit | 5d3189d7345dd3b26a5753a16020ed4f7df0c4b1 (patch) | |
| tree | 8b260aa3116d6a2cdf58950e332726a3678754d3 /pong.py | |
| parent | c8aa48924b284512075432b042ca15c31394ed14 (diff) | |
| download | bwinf-33-5d3189d7345dd3b26a5753a16020ed4f7df0c4b1.tar.gz bwinf-33-5d3189d7345dd3b26a5753a16020ed4f7df0c4b1.zip | |
Verschieben aller Dateien in Unterordner
Diffstat (limited to 'pong.py')
| -rw-r--r-- | pong.py | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/pong.py b/pong.py deleted file mode 100644 index 574253a..0000000 --- a/pong.py +++ /dev/null @@ -1,79 +0,0 @@ -# zustand.Ball -# Ball.xKoordinate() -# Ball.yKoordinate() -# -# zustand.listeBall() -# zustand.Schlaeger -# Schlaeger.identifikation() -# Schlaeger.yKoordinate() -# Schlaeger.punktzahl() -# zustand.listeSchlaeger() -# -# zug.ausgabe(text) -# zug.nachOben() -# zug.nachUnten() - -import math - -def zug(id, zustand, zug): - if not "round" in globals(): - # in der ersten Runde nur initialisieren - globals()["t_ballX"] = globals()["letztes_ballX"] = getBall(zustand).xKoordinate() - globals()["t_ballY"] = globals()["letztes_ballY"] = getBall(zustand).yKoordinate() - globals()["deltaX"] = globals()["deltaY"] = globals()["round"] = globals()["count"] = 0 - return - - globals()["round"] += 1 - -# zug.ausgabe("Runde " + str(globals()["round"])) - - globals()["t_ballX"] = getBall(zustand).xKoordinate() - globals()["t_ballY"] = getBall(zustand).yKoordinate() - - if (globals()["t_ballX"] < 15 and globals()["deltaX"] <= 0) or (globals()["t_ballX"] > 50 and globals()["deltaX"] >= 0) \ - or (globals()["t_ballY"] < 5) or (globals()["t_ballY"] > 55): - globals()["letztes_ballX"], globals()["letztes_ballY"] = globals()["t_ballX"], globals()["t_ballY"] - globals()["count"] = 0 - - if globals()["count"] != 0: - globals()["deltaX"] = float((globals()["t_ballX"] - globals()["letztes_ballX"]) / globals()["count"]) - globals()["deltaY"] = float((globals()["t_ballY"] - globals()["letztes_ballY"]) / globals()["count"]) - globals()["count"] += 1 - - bounces = 0 - if globals()["deltaX"] != 0: - schritte = abs(0 + globals()["t_ballX"] / globals()["deltaX"]) - #nach `schritte` Runden ist der Ball beim anderen Spieler - bounces = math.floor((globals()["t_ballY"] + abs(globals()["deltaY"] * schritte)) / 60) -# zug.ausgabe("Achtung: ") -# zug.ausgabe(bounces) -# zug.ausgabe(schritte) - - if globals()["deltaX"] < 0: - schritte = abs(0 - globals()["t_ballX"]) / globals()["deltaX"] - target_ballY = ((globals()["t_ballY"] + abs(globals()["deltaY"] * schritte)) % 60) - else: - target_ballY = 30 - - if globals()["t_ballX"] > 55 or globals()["t_ballX"] < 10: - target_ballY = globals()["t_ballY"] - - if getMe(zustand, id).yKoordinate() > target_ballY - 3: - zug.nachOben() - else: - if getMe(zustand, id).yKoordinate() < target_ballY - 3: - zug.nachUnten() - -### -def getMe(zustand, id): - if zustand.listeSchlaeger()[0].identifikation() == id: - return zustand.listeSchlaeger()[0] - return zustand.listeSchlaeger()[1] - -def getEnemy(zustand, id): - if zustand.listeSchlaeger()[0].identifikation() == id: - return zustand.listeSchlaeger()[1] - return zustand.listeSchlaeger()[0] - -def getBall(zustand): - return zustand.listeBall()[0] |
