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 = 1200,750 | |
turtle.setup(w,h) | |
colors = ["blue","red","green","yellow"] | |
goals = [] | |
stable = [] | |
y = h//2 |
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
# gist.github.com/horstjens | |
import vpython as vp | |
import random | |
class Game: | |
dt = 0.1 | |
xlimit = 20 | |
ylimit = 10 |
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
# 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 | |
""" |
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: | |
size = 20 | |
class Ball(vp.sphere): | |
def __init__(self): | |
p = vp.vector(random.uniform(0, Game.size), | |
random.uniform(0, Game.size), |
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 | |
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 |
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 | |
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 |
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 | |
from dice2 import diceroll | |
class Monster: | |
def __init__(self, name): | |
self.name = name | |
self.hp = 10 | |
self.attack = 0.7 | |
self.defense = 0.5 |
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 | |
# dice - simulate dungeon & dragons dice to generate random values | |
def diceroll(dicestring): | |
""" | |
lower d for dice rolls without re-roll | |
1d6 -> rolls one six-sided die |
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
# roguelike | |
import os | |
import random | |
def dice(dicestring): | |
""" | |
1d6 -> random integer between 1 and 6 | |
2d6 -> random integer between 2 and 12 | |
1d20+5 -> random integer between 6 and 26 | |
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 | |
# dice - simulate dungeon & dragons dice to generate random values | |
def dice(dicestring): | |
""" | |
1d6 -> random integer between 1 and 6 | |
2d6 -> random integer between 2 and 12 | |
1d20+5 -> random integer between 6 and 26 | |
""" |