-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
executable file
·69 lines (53 loc) · 1.9 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
import glob
import signal
import sys
from pathlib import Path
import blockly.web
import blockly.game
from blockly.map import GameMap
from blockly.team import Team, data_dir as teams_dir
# Ensure directories exists
save_dirs = ["save_small", "save_medium", "save_large"]
for save_dir in save_dirs:
Path(save_dir).mkdir(parents=True, exist_ok=True)
Path(teams_dir).mkdir(parents=True, exist_ok=True)
teams = [
Team("red", "steamCrazyHorse"),
Team("green", "lazyCoalSprings"),
Team("blue", "dryWaterMine"),
Team("yellow", "burningCoalSprings"),
Team("pink", "drySteamTelegram"),
Team("violet", "heroicOldCowboy"),
Team("olive", "funnySmallBuffalo"),
Team("maroon", "sweetDeadWhisky"),
Team("black", "brokenLittleRevolver"),
Team("white", "lazyWiseSheriff"),
]
def stop_handler(sig, frame):
blockly.game.G.stop_timer()
sys.exit(0)
# MALÁ MAPA:
# game_map = GameMap(width=20, height=20, teams=teams,
# cowboys_per_team=1,
# gold_count=10,
# load_saves=True,
# save_dir="save_small")
# STŘEDNÍ MAPA:
# game_map = GameMap(width=40, height=40, teams=teams,
# cowboys_per_team=4,
# gold_count=20,
# load_saves=True,
# save_dir="save_medium")
# VELKÁ MAPA:
game_map = GameMap(width=50, height=50, teams=teams,
cowboys_per_team=10,
gold_count=50,
wall_fraction=2, cluster_max=500,
load_saves=True,
save_dir="save_large")
blockly.game.G = blockly.game.Game(teams=teams, map=game_map, org_login="org", org_passwd="org")
# blockly.game.G.startTimer()
signal.signal(signal.SIGINT, stop_handler)
debug = len(sys.argv) > 1 and sys.argv[1] in ("--debug", "-debug")
blockly.web.app.run(debug=debug, threaded=True, processes=1)