Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

2 Python Scripts (Visualizer & Destructable Scene Engine)

Visualiser:




Destructible Scene




Both scripts are available at http://www.trogramming.com/Programs/index.html (Just made the site, still got to add content.)

Or directly downloadable at :
http://www.trogramming.com/Programs/Scri...ualiser.py
http://www.trogramming.com/Programs/Scripts/bomb.py
This is fucking amazing :p
First time I see something like that :P
wow, especially that visualiser in 26 rows is great achievement...

interesting that I haven't ever heard about that visual library before...
Thanks heaps guys appreciate the responses, here's a small bonus script I just whipped up then. Sorry for the lack of commenting, I'm happy to answer any questions people may be having.

Code
from __future__ import division
from visual import *
from math import *
a=[]
loops=10
radius=1
for degr in range(36*loops):
    x= cos(radians(degr*10))*radius
    y= sin(radians(degr*10))*radius
    z= cos(radians(degr*10*loops))
    a.insert(degr,[sphere(pos=(x,y,z),radius=(abs(x)+abs(y))/16,visible=False),curve(color=(1,1,1))])
    radius = radius+degrees(1.618033989)
b=0
while 1:
    rate(20)
    b=b+1
    radius=1
    for i in range(len(a)):
  x= cos(radians((i+b)*10))*radius
  y= sin(radians((i+b)*10))*radius
  z= cos(radians((i+b)*10*loops))*radius*cos(radians(b))
  a[i][0].pos=(x,y,z)
  a[i][1].append(a[i][0].pos)
  a[i][1].color= color.hsv_to_rgb(((b+i)%256/256,(b+1+64)%256/256,(b+1+128)%100/256+.6))
  radius = radius+degrees(1.618033989)



(Feb 2, 2012 12:40 PM)PseudoMander Wrote:  Thanks heaps guys appreciate the responses, here's a small bonus script I just whipped up then. Sorry for the lack of commenting, I'm happy to answer any questions people may be having.

Code
from __future__ import division
from visual import *
from math import *
a=[]
loops=10
radius=1
for degr in range(36*loops):
    x= cos(radians(degr*10))*radius
    y= sin(radians(degr*10))*radius
    z= cos(radians(degr*10*loops))
    a.insert(degr,[sphere(pos=(x,y,z),radius=(abs(x)+abs(y))/16,visible=False),curve(color=(1,1,1))])
    radius = radius+degrees(1.618033989)
b=0
while 1:
    rate(20)
    b=b+1
    radius=1
    for i in range(len(a)):
  x= cos(radians((i+b)*10))*radius
  y= sin(radians((i+b)*10))*radius
  z= cos(radians((i+b)*10*loops))*radius*cos(radians(b))
  a[i][0].pos=(x,y,z)
  a[i][1].append(a[i][0].pos)
  a[i][1].color= color.hsv_to_rgb(((b+i)%256/256,(b+1+64)%256/256,(b+1+128)%100/256+.6))
  radius = radius+degrees(1.618033989)
Awesome, although I can't really understand how do you come up with it - do you use same frame and randomly change constants or are your changes purposeful (e.g. can you imagine it before actually running it)?
Usually I imagine a structure then make it to the best of my ability. However mid-way through design I'm often inspired to take it in a different direction and will usually do so, so to answer your question they're not always congruent to the pictures in my head but are quite slight adaptions of such (On a mathematical level anyway).
This is awesome...
btw managed to crash your cannon sim/ w/e, here's error for future bug fix :P
Code
Traceback (most recent call last):
  File "C:\Users\Dom\Desktop\visualiser.py", line 207, in <module>
    checkcolbomb()
  File "C:\Users\Dom\Desktop\visualiser.py", line 121, in checkcolbomb
    burst(bomb[i][0].pos,bomb[i][0].velocity)
  File "C:\Users\Dom\Desktop\visualiser.py", line 76, in burst
    makewall(blockwall[i1-e].pos,dire,blockwall[i1-e].size[1]/6)
  File "C:\Users\Dom\Desktop\visualiser.py", line 143, in makewall
    for i2 in range(height):
TypeError: range() integer end argument expected, got float.
(Feb 3, 2012 05:01 AM)Dmaster_773 Wrote:  This is awesome...
btw managed to crash your cannon sim/ w/e, here's error for future bug fix :P
Code
...
    for i2 in range(height):
TypeError: range() integer end argument expected, got float.
...

Thanks for that, I've never encountered it perhaps it could be patched by simply replacing the aforementioned line with.
Code
for i2 in range(int(round(height))):


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by LifeAug 10, 2020 09:42 PM 0 166 Aug 10, 2020 09:42 PM
Last Post: Life
[Python] by DawnfangMay 14, 2020 01:27 AM 3 233 May 14, 2020 01:27 AM
Last Post: D34r_Us3rn4m3