codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
import math import random output = "Gravity Fun at TestTubeGames: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0]" asteroids = 50 mass = 9001 output = output + ", [x0: 0,y0: 0,vx: 0,vy: 0,t0: 0,who: 2,m: " + str(mass) + ",c: 1]" for a in range(asteroids): angle = random.random()*math.pi*2 radius = random.random()*120+20 vel = math.sqrt(mass/radius) output = output + ", [x0: " + str(radius * math.cos(angle)) + ",y0: " + str(radius * math.sin(angle)) + ",vx: " + str(vel * math.cos(angle + math.pi/2)) + ",vy: " + str(vel * math.sin(angle + math.pi/2)) + ",t0: 0,who: 2,m: 2,c: 2]" print output
Private
[
?
]
Run code
Submit