Skip to content

Commit

Permalink
Add a common directory to the server application
Browse files Browse the repository at this point in the history
Signed-off-by: yzamir <kobi.zamir@gmail.com>
  • Loading branch information
yaacov committed Sep 12, 2023
1 parent 9affc20 commit 703e743
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
Empty file added rose/server/common/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions rose/server/common/actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
""" Driving actions """

NONE = "none" # NOQA
RIGHT = "right" # NOQA
LEFT = "left" # NOQA
PICKUP = "pickup" # NOQA
JUMP = "jump" # NOQA
BRAKE = "brake" # NOQA

ALL = (NONE, RIGHT, LEFT, PICKUP, JUMP, BRAKE)
20 changes: 20 additions & 0 deletions rose/server/common/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# config.py

# Default Configuration
drivers = []
run = "stop"

game_rate = 1.0
game_duration = 60

matrix_height = 9
matrix_width = 6

max_players = 2
cells_per_player = 3

score_move_forward = 10
score_move_backward = -10
score_pickup = 10
score_jump = 5
score_brake = 4
17 changes: 17 additions & 0 deletions rose/server/common/obstacles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
""" Game obstacles """

import random

NONE = "" # NOQA
CRACK = "crack" # NOQA
TRASH = "trash" # NOQA
PENGUIN = "penguin" # NOQA
BIKE = "bike" # NOQA
WATER = "water" # NOQA
BARRIER = "barrier" # NOQA

ALL = (NONE, CRACK, TRASH, PENGUIN, BIKE, WATER, BARRIER)


def get_random_obstacle():
return random.choice(ALL)

0 comments on commit 703e743

Please sign in to comment.