python_code
stringlengths
0
869k
from .vec_env import VecEnvWrapper import numpy as np from gym import spaces class VecFrameStack(VecEnvWrapper): def __init__(self, venv, nstack): self.venv = venv self.nstack = nstack wos = venv.observation_space # wrapped ob space low = np.repeat(wos.low, self.nstack, axis=-1) ...
import contextlib import os from abc import ABC, abstractmethod from baselines.common.tile_images import tile_images class AlreadySteppingError(Exception): """ Raised when an asynchronous step is running while step_async() is called again. """ def __init__(self): msg = 'already running an...
import multiprocessing as mp import numpy as np from .vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars def worker(remote, parent_remote, env_fn_wrappers): def step_env(env, action): ob, reward, done, info = env.step(action) if done: ob = env.reset() return ob, rew...
""" Helpers for dealing with vectorized environments. """ from collections import OrderedDict import gym import numpy as np def copy_obs_dict(obs): """ Deep-copy an observation dict. """ return {k: np.copy(v) for k, v in obs.items()} def dict_to_obs(obs_dict): """ Convert an observation di...
import os from baselines import logger from baselines.common.vec_env import VecEnvWrapper from gym.wrappers.monitoring import video_recorder class VecVideoRecorder(VecEnvWrapper): """ Wrap VecEnv to record rendered image as mp4 video. """ def __init__(self, venv, directory, record_video_trigger, vide...
from .vec_env import VecEnvObservationWrapper class VecExtractDictObs(VecEnvObservationWrapper): def __init__(self, venv, key): self.key = key super().__init__(venv=venv, observation_space=venv.observation_space.spaces[self.key]) def process(self, obs): return obs[self.key]...
from .vec_env import AlreadySteppingError, NotSteppingError, VecEnv, VecEnvWrapper, VecEnvObservationWrapper, CloudpickleWrapper from .dummy_vec_env import DummyVecEnv from .shmem_vec_env import ShmemVecEnv from .subproc_vec_env import SubprocVecEnv from .vec_frame_stack import VecFrameStack from .vec_monitor import Ve...
from . import VecEnvWrapper from baselines.bench.monitor import ResultsWriter import numpy as np import time from collections import deque class VecMonitor(VecEnvWrapper): def __init__(self, venv, filename=None, keep_buf=0, info_keywords=()): VecEnvWrapper.__init__(self, venv) self.eprets = None ...
from . import VecEnvWrapper import numpy as np class VecNormalize(VecEnvWrapper): """ A vectorized wrapper that normalizes the observations and returns from an environment. """ def __init__(self, venv, ob=True, ret=True, clipob=10., cliprew=10., gamma=0.99, epsilon=1e-8, use_tf=False): Vec...
import numpy as np from .vec_env import VecEnv from .util import copy_obs_dict, dict_to_obs, obs_space_info class DummyVecEnv(VecEnv): """ VecEnv that does runs multiple environments sequentially, that is, the step and reset commands are send to one environment at a time. Useful when debugging and when...
import numpy as np from baselines.common.runners import AbstractEnvRunner class Runner(AbstractEnvRunner): """ We use this object to make a mini batch of experiences __init__: - Initialize the runner run(): - Make a mini batch """ def __init__(self, *, env, model, nsteps, gamma, lam): ...
import os import time import numpy as np import os.path as osp from baselines import logger from collections import deque from baselines.common import explained_variance, set_global_seeds from baselines.common.policies import build_policy try: from mpi4py import MPI except ImportError: MPI = None from baselines...
import tensorflow as tf import numpy as np from baselines.ppo2.model import Model class MicrobatchedModel(Model): """ Model that does training one microbatch at a time - when gradient computation on the entire minibatch causes some overflow """ def __init__(self, *, policy, ob_space, ac_space, nbat...
import gym import tensorflow as tf import numpy as np from functools import partial from baselines.common.vec_env.dummy_vec_env import DummyVecEnv from baselines.common.tf_util import make_session from baselines.ppo2.ppo2 import learn from baselines.ppo2.microbatched_model import MicrobatchedModel def test_microbatc...
import tensorflow as tf import functools from baselines.common.tf_util import get_session, save_variables, load_variables from baselines.common.tf_util import initialize try: from baselines.common.mpi_adam_optimizer import MpiAdamOptimizer from mpi4py import MPI from baselines.common.mpi_util import sync_...
def mujoco(): return dict( nsteps=2048, nminibatches=32, lam=0.95, gamma=0.99, noptepochs=10, log_interval=1, ent_coef=0.0, lr=lambda f: 3e-4 * f, cliprange=0.2, value_network='copy' ) def atari(): return dict( nsteps=1...
import numpy as np def make_sample_her_transitions(replay_strategy, replay_k, reward_fun): """Creates a sample function that can be used for HER experience replay. Args: replay_strategy (in ['future', 'none']): the HER replay strategy; if set to 'none', regular DDPG experience replay is u...
import tensorflow as tf from baselines.her.util import store_args, nn class ActorCritic: @store_args def __init__(self, inputs_tf, dimo, dimg, dimu, max_u, o_stats, g_stats, hidden, layers, **kwargs): """The actor-critic network and related training code. Args: in...
import os import subprocess import sys import importlib import inspect import functools import tensorflow as tf import numpy as np from baselines.common import tf_util as U def store_args(method): """Stores provided method args as instance attributes. """ argspec = inspect.getfullargspec(method) def...
from collections import deque import numpy as np import pickle from baselines.her.util import convert_episode_to_batch_major, store_args class RolloutWorker: @store_args def __init__(self, venv, policy, dims, logger, T, rollout_batch_size=1, exploit=False, use_target_net=False, compute_Q=F...
from collections import OrderedDict import numpy as np import tensorflow as tf from tensorflow.contrib.staging import StagingArea from baselines import logger from baselines.her.util import ( import_function, store_args, flatten_grads, transitions_in_episode_batch, convert_episode_to_batch_major) from baselines.h...
import threading import numpy as np class ReplayBuffer: def __init__(self, buffer_shapes, size_in_transitions, T, sample_transitions): """Creates a replay buffer. Args: buffer_shapes (dict of ints): the shape for all buffers that are used in the replay buffer ...
import os import click import numpy as np import json from mpi4py import MPI from baselines import logger from baselines.common import set_global_seeds, tf_util from baselines.common.mpi_moments import mpi_moments import baselines.her.experiment.config as config from baselines.her.rollout import RolloutWorker def mp...
import threading import numpy as np from mpi4py import MPI import tensorflow as tf from baselines.her.util import reshape_for_broadcasting class Normalizer: def __init__(self, size, eps=1e-2, default_clip_range=np.inf, sess=None): """A normalizer that ensures that observations are approximately distribu...
# DEPRECATED, use baselines.common.plot_util instead import os import matplotlib.pyplot as plt import numpy as np import json import seaborn as sns; sns.set() import glob2 import argparse def smooth_reward_curve(x, y): halfwidth = int(np.ceil(len(x) / 60)) # Halfwidth of our smoothing convolution k = halfwi...
import os import numpy as np import gym from baselines import logger from baselines.her.ddpg import DDPG from baselines.her.her_sampler import make_sample_her_transitions from baselines.bench.monitor import Monitor DEFAULT_ENV_PARAMS = { 'FetchReach-v1': { 'n_cycles': 10, }, } DEFAULT_PARAMS = { ...
# DEPRECATED, use --play flag to baselines.run instead import click import numpy as np import pickle from baselines import logger from baselines.common import set_global_seeds import baselines.her.experiment.config as config from baselines.her.rollout import RolloutWorker @click.command() @click.argument('policy_fil...
import gym import numpy as np """Data generation for the case of a single block pick and place in Fetch Env""" actions = [] observations = [] infos = [] def main(): env = gym.make('FetchPickAndPlace-v1') numItr = 100 initStateSpace = "random" env.reset() print("Reset!") while len(actions) < ...
import tensorflow as tf import tensorflow.contrib.layers as layers def build_q_func(network, hiddens=[256], dueling=True, layer_norm=False, **network_kwargs): if isinstance(network, str): from baselines.common.models import get_network_builder network = get_network_builder(network)(**network_kwarg...
from baselines.deepq import models # noqa from baselines.deepq.build_graph import build_act, build_train # noqa from baselines.deepq.deepq import learn, load_act # noqa from baselines.deepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer # noqa def wrap_atari_dqn(env): from baselines.common.atari_wr...
"""Deep Q learning graph The functions in this file can are used to create the following functions: ======= act ======== Function to chose an action given an observation Parameters ---------- observation: object Observation that can be feed into the output of make_obs_ph stochastic: bool...
from baselines.common.input import observation_input from baselines.common.tf_util import adjust_shape # ================================================================ # Placeholders # ================================================================ class TfInput(object): def __init__(self, name="(unnamed)"): ...
import os import tempfile import tensorflow as tf import zipfile import cloudpickle import numpy as np import baselines.common.tf_util as U from baselines.common.tf_util import load_variables, save_variables from baselines import logger from baselines.common.schedules import LinearSchedule from baselines.common impor...
import numpy as np import random from baselines.common.segment_tree import SumSegmentTree, MinSegmentTree class ReplayBuffer(object): def __init__(self, size): """Create Replay buffer. Parameters ---------- size: int Max number of transitions to store in the buffer. W...
def atari(): return dict( network='conv_only', lr=1e-4, buffer_size=10000, exploration_fraction=0.1, exploration_final_eps=0.01, train_freq=4, learning_starts=10000, target_network_update_freq=1000, gamma=0.99, prioritized_replay=True, ...
import gym import itertools import numpy as np import tensorflow as tf import tensorflow.contrib.layers as layers import baselines.common.tf_util as U from baselines import logger from baselines import deepq from baselines.deepq.replay_buffer import ReplayBuffer from baselines.deepq.utils import ObservationInput from...
import gym from baselines import deepq def main(): env = gym.make("PongNoFrameskip-v4") env = deepq.wrap_atari_dqn(env) model = deepq.learn( env, "conv_only", convs=[(32, 8, 4), (64, 4, 2), (64, 3, 1)], hiddens=[256], dueling=True, total_timesteps=0 ) ...
import gym from baselines import deepq def callback(lcl, _glb): # stop training if reward exceeds 199 is_solved = lcl['t'] > 100 and sum(lcl['episode_rewards'][-101:-1]) / 100 >= 199 return is_solved def main(): env = gym.make("CartPole-v0") act = deepq.learn( env, network='mlp'...
import gym from baselines import deepq def main(): env = gym.make("CartPole-v0") act = deepq.learn(env, network='mlp', total_timesteps=0, load_path="cartpole_model.pkl") while True: obs, done = env.reset(), False episode_rew = 0 while not done: env.render() ...
import gym from baselines import deepq from baselines.common import models def main(): env = gym.make("MountainCar-v0") # Enabling layer_norm here is import for parameter space noise! act = deepq.learn( env, network=models.mlp(num_hidden=64, num_layers=1), lr=1e-3, total_t...
from baselines import deepq from baselines import bench from baselines import logger from baselines.common.atari_wrappers import make_atari def main(): logger.configure() env = make_atari('PongNoFrameskip-v4') env = bench.Monitor(env, logger.get_dir()) env = deepq.wrap_atari_dqn(env) model = deep...
import gym from baselines import deepq from baselines.common import models def main(): env = gym.make("MountainCar-v0") act = deepq.learn( env, network=models.mlp(num_layers=1, num_hidden=64), total_timesteps=0, load_path='mountaincar_model.pkl' ) while True: ...
import tensorflow as tf def gmatmul(a, b, transpose_a=False, transpose_b=False, reduce_dim=None): assert reduce_dim is not None # weird batch matmul if len(a.get_shape()) == 2 and len(b.get_shape()) > 2: # reshape reduce_dim to the left most dim in b b_shape = b.get_shape() if redu...
import os.path as osp import time import functools import tensorflow as tf from baselines import logger from baselines.common import set_global_seeds, explained_variance from baselines.common.policies import build_policy from baselines.common.tf_util import get_session, save_variables, load_variables from baselines.a...
import tensorflow as tf def dense(x, size, name, weight_init=None, bias_init=0, weight_loss_dict=None, reuse=None): with tf.variable_scope(name, reuse=reuse): assert (len(tf.get_variable_scope().name.split('/')) == 2) w = tf.get_variable("w", [x.get_shape()[1], size], initializer=weight_init) ...
def mujoco(): return dict( nsteps=2500, value_network='copy' )
import tensorflow as tf import numpy as np import re # flake8: noqa F403, F405 from baselines.acktr.kfac_utils import * from functools import reduce KFAC_OPS = ['MatMul', 'Conv2D', 'BiasAdd'] KFAC_DEBUG = False class KfacOptimizer(): # note that KfacOptimizer will be truly synchronous (and thus deterministic) ...
import numpy as np from baselines.a2c.utils import discount_with_dones from baselines.common.runners import AbstractEnvRunner class Runner(AbstractEnvRunner): """ We use this class to generate batches of experiences __init__: - Initialize the runner run(): - Make a mini batch of experiences ...
import os import numpy as np import tensorflow as tf from collections import deque def sample(logits): noise = tf.random_uniform(tf.shape(logits)) return tf.argmax(logits - tf.log(-tf.log(noise)), 1) def cat_entropy(logits): a0 = logits - tf.reduce_max(logits, 1, keepdims=True) ea0 = tf.exp(a0) z0...
import time import functools import tensorflow as tf from baselines import logger from baselines.common import set_global_seeds, explained_variance from baselines.common import tf_util from baselines.common.policies import build_policy from baselines.a2c.utils import Scheduler, find_trainable_variables from baselin...
from baselines.common import explained_variance, zipsame, dataset from baselines import logger import baselines.common.tf_util as U import tensorflow as tf, numpy as np import time from baselines.common import colorize from collections import deque from baselines.common import set_global_seeds from baselines.common.mpi...
from baselines.common.models import mlp, cnn_small def atari(): return dict( network = cnn_small(), timesteps_per_batch=512, max_kl=0.001, cg_iters=10, cg_damping=1e-3, gamma=0.98, lam=1.0, vf_iters=3, vf_stepsize=1e-4, entcoeff=0.00,...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Setup script for pybox2d. For installation instructions, see INSTALL. Basic install steps: python setup.py build If that worked, then: python setup.py install """ import os import sys from glob import glob __author__='Ken Lauer' __license__='zlib' __date__="$Date...
import os for platform in ['win32', 'win-amd64']: versions=['2.5', '2.6', '2.7', '3.0', '3.1', '3.2'] def get_path(platform, version): if platform=='win32': version_path='' else: version_path='-x64' return r'c:\python%s%s\python.exe'%(version.replace('.', ''), v...
from all_classes import * print(""" /* * pybox2d -- http://pybox2d.googlecode.com * * Copyright (c) 2010 Ken Lauer / sirkne at gmail dot com * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this sof...
classname = "b2DebugDraw" gets = "GetFlags SetFlags ClearFlags AppendFlags".split(" ") sets = "".split(" ") kwargs = True # remove duplicates gets = list(set(gets)) sets = list(set(sets)) renames = ["%%rename(__%s) %s::%s;" % (s, classname, s) for s in gets+sets if s not in ('GetAnchorA', 'GetAnch...
from __future__ import print_function # add "b2ContactPoint", as it's custom # First, define some classes not seen by swig ignore = ["b2ContactConstraint", "b2PolygonContact", "b2PolygonAndCircleContact", "b2CircleContact", "b2JointType", "b2BodyType", "b2ContactSolver", "b2PointState", "b2WorldQueryWrapper", "b2Worl...
from __future__ import print_function import glob import re import os from all_classes import * files = glob.glob('../Box2D/Box2D_*.i') classes = {} ignore_files = [ 'Box2D_kwargs.i', 'Box2D_dir.i', ] def find_extended(path): f = open(path, "r") fn = os.path.split(path)[1] for li...
from all_classes import * print(""" /* * pybox2d -- http://pybox2d.googlecode.com * * Copyright (c) 2010 Ken Lauer / sirkne at gmail dot com * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this sof...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import itertools import sys class testJoints (unittest.TestCase): world = None dbody1 = None dbody2 = None sbody1 = None sbody2 = None def _fail(self, s): # This little function would save us from an AssertionError on garbag...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from Box2D import * import Box2D class cl (b2ContactListener): pass class test_body (unittest.TestCase): def setUp(self): pass def test_world(self): world = b2World(gravity=(0,-10), doSleep=True) world = b2World((0,-10)...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from Box2D import * class cl (b2ContactListener): pass class test_kwargs (unittest.TestCase): def setUp(self): pass def test_kwargs(self): self.cont_list=cl() world = b2World(gravity=(0,-10), doSleep=True, contactListen...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from Box2D import b2Vec2, b2Vec3, b2Mat22, b2Mat33 class testMatrix (unittest.TestCase): def checkAlmostEqual(self, v1, v2, msg): for a, b in zip(v1, v2): self.assertAlmostEqual(a, b, places=3, msg="%s, a=%f b=%f ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import Box2D import sys class testWorld (unittest.TestCase): def setUp(self): pass def test_world(self): try: world = Box2D.b2World(Box2D.b2Vec2(0.0, -10.0), True) world = Box2D.b2World((0.0, -10.0), True) ...
#!/usr/bin/env python import unittest from Box2D import (b2Vec2, b2Vec3) class testVector (unittest.TestCase): def test_vec2_zero(self): v2 = b2Vec2() self.assertAlmostEqual(v2.x, 0.0) self.assertAlmostEqual(v2.y, 0.0) def test_vec2(self): x, y = 1.0, 2.0 v = b2Vec2(x...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from Box2D import b2Color class testColor (unittest.TestCase): def checkAlmostEqual(self, v1, v2, msg, places=3): for i, (a, b) in enumerate(zip(v1, v2)): self.assertAlmostEqual(a, b, places=places, msg="(index %...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import sys class testBasic (unittest.TestCase): # def setUp(self): # pass def test_import(self): try: import Box2D except ImportError: self.fail("Unable to import Box2D library (%s)" % sys.exc_info()[1]...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from Box2D import * from math import cos, sin import sys class ContactListener(b2ContactListener): pass class testPolyshape (unittest.TestCase): def setUp(self): pass def dotest(self, world, v): body = world.CreateDynamicBody(p...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import Box2D as b2 import sys class testEdgeChain (unittest.TestCase): def setUp(self): pass def test_create_edge_chain(self): world = b2.b2World() ground = world.CreateBody(position=(0, 20)) try: groun...
raise NotImplementedError('This should be auto-generated by swig')
raise NotImplementedError
# pybox2d -- http://pybox2d.googlecode.com # # Copyright (c) 2010 Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this software. # Permission is granted to anyone...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This is a simple example of building and running a simulation using Box2D. Here we create a large ground box and a small dynamic box. ** NOTE ** There is no graphical output for this simple example, only text. """ from Box2D import (b2PolygonShape, b2World) world = ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version Copyright (c) 2010 kne / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any d...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A small self contained example showing how to use OpencvDrawFuncs to integrate pybox2d into an opencv mainloop In short: One static body: + One fixture: big polygon to represent the ground Two dynamic bodies: + One fixture: a polygon + One fixture: a circle...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version Copyright (c) 2010 kne / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any d...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version Copyright (c) 2010 kne / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any d...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version Copyright (c) 2010 kne / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any d...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version Copyright (c) 2010 kne / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any d...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version Copyright (c) 2010 kne / sirkne at gmail dot com # # Implemented using the pybox2d SWIG interface for Box2D (pybox2d.googlecode.com) # # This software is provided 'as-is', without any e...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Based on Chris Campbell's tutorial from iforce2d.net: http://www.iforce2d.net/b2dtut/top-down-car """ from .framework import (Framework, Keys, main) import math class TDGroundArea(object): """ An area on the ground that the car can run over """ def _...