Links und Funktionen
Sprachumschaltung

Navigationspfad
Sie sind hier: Startseite / Probestudium / 2012 / WS I: 3D-Programmierung / Arbeitsgruppen / Schach / Schachfiguren5


Inhaltsbereich

Schachfiguren5

-

Figuren.py — text/python-source, 6 KB (6153 bytes)

Dateiinhalt

from visual import * 

straight = [(0,0,2), (0,0,-2)]
semicircle = paths.arc(radius=1, angle2=pi*2)


class Bauer2 (frame):
    def __init__ (self, pos= (-7,0,0), W=True):
        frame.__init__(self, pos=pos)
        six = Polygon( [(0,0), (0,7), (1,6), (1,5), (.2,4), (3,0)] )
        extrusion (pos = semicircle, shape=six,frame=self, material=materials.wood, color=(0.4,0.4,0.4))

class Turm2 (frame):
    def __init__ (self, pos= (-14,0,0)):
        frame.__init__(self, pos=pos)
        ten = Polygon ( [(0,0), (0,7), (3,7), (3,5), (2,5), (2,0)] )
        extrusion (pos = semicircle, shape=ten,frame=self, material=materials.wood, color=(0.4,0.4,0.4))
        semicircle2 = paths.arc(radius=1, angle2=pi/4)
        four = Polygon ( [(2,7), (3,7), (3,8), (2,8 )] ) 
        extrusion (pos=semicircle2, shape=four, frame=self, material=materials.wood, color=(0.4,0.4,0.4))
        e1=frame(frame=self)
        e=extrusion (pos=semicircle2, shape=four, frame=e1, material=materials.wood, color=(0.4,0.4,0.4))
        e1.rotate(angle=pi/2, axis=(0,1,0), origin= (0,0,0))
        e2=frame(frame=self)
        e=extrusion (pos=semicircle2, shape=four, frame=e2, material=materials.wood, color=(0.4,0.4,0.4))
        e2.rotate(angle=pi, axis=(0,1,0), origin= (0,0,0))
        e3=frame(frame=self)
        e=extrusion (pos=semicircle2, shape=four, frame=e3, material=materials.wood, color=(0.4,0.4,0.4))
        e3.rotate(angle=pi*1.5, axis=(0,1,0), origin= (0,0,0))

class Dame2 (frame):
    def __init__ (self,pos= (-21,0,0)):
        frame.__init__(self, pos=pos)
        eleven = Polygon ( [(0,0), (0,12), (1,11), (1,10), (.5,9), (2,9), (2,8), (.5,8), (2,7), (2,6), (1,5), (3,0)])
        extrusion (pos = semicircle, shape=eleven,frame=self, material=materials.wood, color=(0.4,0.4,0.4))

class Koenig2 (frame):
    def __init__ (self,pos= (-28,0,0)):
        frame.__init__(self, pos=pos)
        twelve = Polygon ([(0,0), (0,12), (1,11), (1,11), (2,11), (2,9), (1,9), (1,8), (2,7), (2,6), (1,5), (1,5), (3,0)])
        mybox = box(pos=(0,14,0), length=4, height=1, width=1, frame=self, material=materials.wood, color=(0.4,0.4,0.4))
        mybox2 = box(pos=(0,12,0), length=1, height=7, width=1, frame=self, material=materials.wood, color=(0.4,0.4,0.4))
        extrusion (pos = semicircle, shape=twelve,frame=self, material=materials.wood, color=(0.4,0.4,0.4))
        
class Laeufer2 (frame):
    def __init__ (self,pos= (-35,0,0)):
        frame.__init__(self, pos=pos)
        eight = Polygon ([(0,0),(0,9),(1,8), (1,7), (.2,4), (1,4), (1,3.2), (.2,3.2), (3,0)])
        extrusion (pos = semicircle, shape=eight,frame=self, material=materials.wood, color=(0.4,0.4,0.4))

class Pferdchen2 (frame):
    def __init__ (self,pos= (-42,0,0)):
        frame.__init__ (self, pos=pos)
        body = Polygon ([(0,0), (0,3), (2.5,3), (3,0)])
        extrusion (pos = semicircle, shape=body,frame=self, material=materials.wood, color=(0.4,0.4,0.4))
        head = Polygon ([(-3,3), (-1,4), (-2,4.2), (-3,4), (-3.2,6), (0,7), (1,8), (1.2,7), (2,5), (3,3)])
        extrusion (pos = straight, shape=head,frame=self, material=materials.wood, color=(0.4,0.4,0.4))

class Bauer (frame):
    def __init__ (self, pos= (0,0,0), W=True):
        frame.__init__(self, pos=pos)
        six = Polygon( [(0,0), (0,7), (1,6), (1,5), (.2,4), (3,0)] )
        extrusion (pos = semicircle, shape=six,frame=self, material=materials.wood)

class Turm (frame):
    def __init__ (self, pos= (7,0,0)):
        frame.__init__(self, pos=pos)
        ten = Polygon ( [(0,0), (0,7), (3,7), (3,5), (2,5), (2,0)] )
        extrusion (pos = semicircle, shape=ten,frame=self, material=materials.wood)
        semicircle2 = paths.arc(radius=1, angle2=pi/4)
        four = Polygon ( [(2,7), (3,7), (3,8), (2,8)] ) 
        extrusion (pos=semicircle2, shape=four, frame=self, material=materials.wood)
        e1=frame(frame=self)
        e=extrusion (pos=semicircle2, shape=four, frame=e1, material=materials.wood)
        e1.rotate(angle=pi/2, axis=(0,1,0), origin= (0,0,0))
        e2=frame(frame=self)
        e=extrusion (pos=semicircle2, shape=four, frame=e2, material=materials.wood)
        e2.rotate(angle=pi, axis=(0,1,0), origin= (0,0,0))
        e3=frame(frame=self)
        e=extrusion (pos=semicircle2, shape=four, frame=e3, material=materials.wood)
        e3.rotate(angle=pi*1.5, axis=(0,1,0), origin= (0,0,0))

class Dame (frame):
    def __init__ (self,pos= (14,0,0)):
        frame.__init__(self, pos=pos)
        eleven = Polygon ( [(0,0), (0,12), (1,11), (1,10), (.5,9), (2,9), (2,8), (.5,8), (2,7), (2,6), (1,5), (3,0)])
        extrusion (pos = semicircle, shape=eleven,frame=self, material=materials.wood)

class Koenig (frame):
    def __init__ (self,pos= (21,0,0)):
        frame.__init__(self, pos=pos)
        twelve = Polygon ([(0,0), (0,12), (1,11), (1,11), (2,11), (2,9), (1,9), (1,8), (2,7), (2,6), (1,5), (3,0)])
        mybox = box(pos=(0,14,0), length=4, height=1, width=1, frame=self, material=materials.wood)
        mybox2 = box(pos=(0,12,0), length=1, height=7, width=1, frame=self, material=materials.wood)
        extrusion (pos = semicircle, shape=twelve,frame=self, material=materials.wood)
        
class Laeufer (frame):
    def __init__ (self,pos= (28,0,0)):
        frame.__init__(self, pos=pos)
        eight = Polygon ([(0,0),(0,9),(1,8), (1,7), (.2,4), (1,4), (1,3.2), (.2,3.2), (3,0)])
        extrusion (pos = semicircle, shape=eight,frame=self, material=materials.wood)

class Pferdchen (frame):
    def __init__ (self,pos= (35,0,0)):
        frame.__init__ (self, pos=pos)
        body = Polygon ([(0,0), (0,3), (2.5,3), (3,0)])
        extrusion (pos = semicircle, shape=body,frame=self, material=materials.wood)
        head = Polygon ([(-3,3), (-1,4), (-2,4.2), (-3,4), (-3.2,6), (0,7), (1,8), (1.2,7), (2,5), (3,3)])
        extrusion (pos = straight, shape=head,frame=self, material=materials.wood)


if __name__ == "__main__":
    b=Bauer()
    t=Turm ()
    d=Dame ()
    k=Koenig ()
    l=Laeufer ()
    p=Pferdchen ()
    b2=Bauer2 ()
    t2=Turm2 ()
    d2=Dame2 ()
    k2=Koenig2 ()
    l2=Laeufer2 ()
    p2=Pferdchen2 ()

Funktionsleiste