Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.ru/trac/tanchiki/changeset/2
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Sun Apr 10 17:58:42 2016
Êîäèðîâêà: IBM-866
Changeset 2:e6e7b30ecde0 òÀÓ Tanchiki

Changeset 2:e6e7b30ecde0


Ignore:
Timestamp:
12/18/10 13:23:48 (5 years ago)
Author:
Olga Zolotareva <olya_zol@òÀæ>
Branch:
default
Message:

modules changed

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • body.py

    r1 r2 ˆà
    ˆà1import vectorˆà
    ˆà2ˆà
    13class Body(object):ˆà
    2ˆà        def __init__(self, position, velocity, next_position, radius):ˆà
    ˆà4        def __init__(self, position, velocity, next_position, radius=1):ˆà
    35                self.position = positionˆà
    46                self.velocity = velocityˆà
    òÀæ òÀæ ˆà
    1113                self.strength = strengthˆà
    1214                self.turret = turretˆà
    13ˆà                self.base_orientation = orientationˆà
    ˆà15                self.base_orientation = base_orientationˆà
    1416                self.game = gameˆà
    1517                self.user = userˆà
    16ˆà        def rotate_base(angle):ˆà
    ˆà18        def rotate_base(tank, angle):ˆà
    1719                passˆà
    1820ˆà
    19ˆà        def rotate_turret(angle):ˆà
    ˆà21        def rotate_turret(tank, angle):ˆà
    2022                passˆà
    2123ˆà
    22ˆà        def accelerate(speed_delta):ˆà
    ˆà24        def accelerate(tank, speed_delta):ˆà
    2325                passˆà
    2426ˆà
    25ˆà        def fire():ˆà
    ˆà27        def fire(tank):ˆà
    2628                passˆà
    2729ˆà
    28ˆà        def on_tick(other_tanks, bullets):ˆà
    ˆà30        def on_tick(tank,other_tanks, bullets):ˆà
    2931                passˆà
    3032ˆà
    31ˆà        def on_spawn():ˆà
    ˆà33        def on_spawn(tank):ˆà
    3234                passˆà
    3335ˆà
    34ˆà        def on_death() :ˆà
    ˆà36        def on_death(tank) :ˆà
    3537                passˆà
    3638        ˆà
    37ˆà        def on_hit(bullet):ˆà
    ˆà39        def on_hit(tank,bullet):ˆà
    3840                passˆà
    3941ˆà
    òÀæ òÀæ ˆà
    4143                passˆà
    4244ˆà
    43ˆà        def on_wall():ˆà
    ˆà45        def on_wall(tank):ˆà
    4446                passˆà
    4547ˆà
  • game.py

    r1 r2 ˆà
    66                self.height = heightˆà
    77ˆà
    8ˆà        def step():ˆà
    9ˆà                passˆà
    ˆà8        def step(game):ˆà
    ˆà9                game.next_positions()ˆà
    ˆà10                game.check_collisions()ˆà
    ˆà11                game.check_walls()ˆà
    ˆà12                game.update_positions()ˆà
    ˆà13                game.invoke_ticks()ˆà
    ˆà14                game.respawn()ˆà
    1015ˆà
    11ˆà        def next_positions():ˆà
    12ˆà                passˆà
    ˆà16        def next_positions(game):ˆà
    ˆà17                delta_t = 1ˆà
    ˆà18                for i in game.bodies:ˆà
    ˆà19                        i.next_position = i.position + i.velocity.mul_v(delta_t)ˆà
    1320        ˆà
    14ˆà        def check_collisions():ˆà
    ˆà21ˆà
    ˆà22        def check_collisions(game):ˆà
    1523                passˆà
    1624ˆà
    òÀæ òÀæ ˆà
    2129                        passˆà
    2230ˆà
    23ˆà        def check_walls():ˆà
    24ˆà                passˆà
    ˆà31        def check_walls(game):ˆà
    ˆà32                for i in game.bodies :ˆà
    ˆà33                        if (i.next_position.x <= 0) or (i.next_position.y <= 0) or (i.next_position.x <= width) or (i.next_position.y >= game.height) :ˆà
    ˆà34                                i.on_wall()ˆà
    ˆà35                ˆà
    2536ˆà
    26ˆà        def update_positions():ˆà
    27ˆà                passˆà
    ˆà37        def update_positions(game):ˆà
    ˆà38                for i in game.bodies:ˆà
    ˆà39                        i.position = i.next_positionˆà
    2840ˆà
    29ˆà        def invoke_ticks():ˆà
    ˆà41        def invoke_ticks(game):ˆà
    3042                passˆà
    3143        ˆà
    32ˆà        def respawn():ˆà
    33ˆà                pass ˆà
    34ˆà                ˆà
    ˆà44        def respawn(game):                     ˆà
    ˆà45                for i in game.users :ˆà
    ˆà46                        if i.tank.strength == 0 :ˆà
    ˆà47                                i.tank.respawn()ˆà
    ˆà48ˆà
    ˆà49ˆà
    ˆà50 ˆà
  • user.py

    r1 r2 ˆà
    11class User(object):     ˆà
    22ˆà
    3ˆà        def __init__(self, base_left , base_right, turret_left, turret_right, accelerate, decelerate, fire, tank):ˆà
    ˆà3        def __init__(self, base_left = False , base_right = False, turret_left = False, turret_right = False, accelerate = False, decelerate = False, fire = False, tank = 0):ˆà
    44                self.base_left = base_leftˆà
    55                self.base_right = base_rightˆà
Note: See TracChangeset for help on using the changeset viewer.