vlak 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.13"
21
+
22
+ - name: Install build dependencies
23
+ run: pip install build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Publish to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
vlak-1.0.0/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ __pycache__
2
+ build
3
+ dist
4
+ .*
5
+ !.gitignore
6
+ !.github
7
+ !.mpyproject
8
+ *.egg-info
9
+ _version.py
10
+ *.md
11
+ !README*.md
12
+ scripts/
vlak-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: vlak
3
+ Version: 1.0.0
4
+ Summary: Train snake puzzle game
5
+ Author-email: Pavel Revak <pavelrevak@gmail.com>
6
+ License: MIT
7
+ Keywords: game,snake,train,puzzle,pygame
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: Topic :: Games/Entertainment :: Puzzle Games
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: arcade>=3.0
15
+
16
+ # vlak
17
+
18
+ Hra hadík s vlakom pre Linux/macOS postavená na Python + Arcade.
19
+
20
+ Port pôvodnej DOS hry od **Miroslav Němček (Panda381)**:
21
+ https://github.com/Panda381
22
+
23
+ ![Python](https://img.shields.io/badge/python-3.13%2B-blue)
24
+ [![PyPI](https://img.shields.io/pypi/v/vlak)](https://pypi.org/project/vlak/)
25
+
26
+ ## Inštalácia
27
+
28
+ ```bash
29
+ pip install vlak
30
+ ```
31
+
32
+ ## Spustenie
33
+
34
+ ```bash
35
+ vlak
36
+ ```
37
+
38
+ ## Ovládanie
39
+
40
+ | Kláves | Akcia |
41
+ |--------|-------|
42
+ | **Šípky** | Zmena smeru vlaku |
43
+ | **Medzerník / Enter** | Ďalšia scéna / potvrdenie hesla |
44
+ | **Escape** | Ukončenie hry |
45
+ | **Alt+1 – Alt+4** | Zmena veľkosti okna (1× – 4×) |
46
+
47
+ Heslo pre preskočenie na konkrétnu scénu zadaj písmenami a potvrď **Enter**.
48
+
49
+ ## Vývoj
50
+
51
+ ### Závislosti
52
+
53
+ - Python 3.13+
54
+ - [arcade](https://api.arcade.academy/) 3.x
55
+
56
+ ### Inštalácia zo zdrojov
57
+
58
+ ```bash
59
+ git clone https://github.com/cortexm/vlak
60
+ cd vlak
61
+ python -m venv .venv
62
+ .venv/bin/pip install -e .
63
+ .venv/bin/vlak
64
+ ```
@@ -0,0 +1,49 @@
1
+ # vlak
2
+
3
+ A train snake game for Linux/macOS built with Python + Arcade.
4
+
5
+ Port of the original DOS game by **Miroslav Němček (Panda381)**:
6
+ https://github.com/Panda381
7
+
8
+ ![Python](https://img.shields.io/badge/python-3.13%2B-blue)
9
+ [![PyPI](https://img.shields.io/pypi/v/vlak)](https://pypi.org/project/vlak/)
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pip install vlak
15
+ ```
16
+
17
+ ## Running
18
+
19
+ ```bash
20
+ vlak
21
+ ```
22
+
23
+ ## Controls
24
+
25
+ | Key | Action |
26
+ |-----|--------|
27
+ | **Arrow keys** | Change train direction |
28
+ | **Space / Enter** | Next scene / confirm password |
29
+ | **Escape** | Quit |
30
+ | **Alt+1 – Alt+4** | Window scale (1× – 4×) |
31
+
32
+ To skip to a specific scene, type its password using letter keys and confirm with **Enter**.
33
+
34
+ ## Development
35
+
36
+ ### Requirements
37
+
38
+ - Python 3.13+
39
+ - [arcade](https://api.arcade.academy/) 3.x
40
+
41
+ ### Install from source
42
+
43
+ ```bash
44
+ git clone https://github.com/cortexm/vlak
45
+ cd vlak
46
+ python -m venv .venv
47
+ .venv/bin/pip install -e .
48
+ .venv/bin/vlak
49
+ ```
vlak-1.0.0/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # vlak
2
+
3
+ Hra hadík s vlakom pre Linux/macOS postavená na Python + Arcade.
4
+
5
+ Port pôvodnej DOS hry od **Miroslav Němček (Panda381)**:
6
+ https://github.com/Panda381
7
+
8
+ ![Python](https://img.shields.io/badge/python-3.13%2B-blue)
9
+ [![PyPI](https://img.shields.io/pypi/v/vlak)](https://pypi.org/project/vlak/)
10
+
11
+ ## Inštalácia
12
+
13
+ ```bash
14
+ pip install vlak
15
+ ```
16
+
17
+ ## Spustenie
18
+
19
+ ```bash
20
+ vlak
21
+ ```
22
+
23
+ ## Ovládanie
24
+
25
+ | Kláves | Akcia |
26
+ |--------|-------|
27
+ | **Šípky** | Zmena smeru vlaku |
28
+ | **Medzerník / Enter** | Ďalšia scéna / potvrdenie hesla |
29
+ | **Escape** | Ukončenie hry |
30
+ | **Alt+1 – Alt+4** | Zmena veľkosti okna (1× – 4×) |
31
+
32
+ Heslo pre preskočenie na konkrétnu scénu zadaj písmenami a potvrď **Enter**.
33
+
34
+ ## Vývoj
35
+
36
+ ### Závislosti
37
+
38
+ - Python 3.13+
39
+ - [arcade](https://api.arcade.academy/) 3.x
40
+
41
+ ### Inštalácia zo zdrojov
42
+
43
+ ```bash
44
+ git clone https://github.com/cortexm/vlak
45
+ cd vlak
46
+ python -m venv .venv
47
+ .venv/bin/pip install -e .
48
+ .venv/bin/vlak
49
+ ```
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools", "setuptools-scm"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vlak"
7
+ dynamic = ["version"]
8
+ description = "Train snake puzzle game"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.11"
12
+ authors = [
13
+ { name = "Pavel Revak", email = "pavelrevak@gmail.com" }
14
+ ]
15
+ keywords = ["game", "snake", "train", "puzzle", "pygame"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: End Users/Desktop",
19
+ "Topic :: Games/Entertainment :: Puzzle Games",
20
+ "Programming Language :: Python :: 3",
21
+ ]
22
+ dependencies = [
23
+ "arcade>=3.0",
24
+ ]
25
+
26
+ [project.scripts]
27
+ vlak = "vlak.vlak:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ include = ["vlak*"]
31
+
32
+ [tool.setuptools.package-data]
33
+ vlak = ["res/**"]
34
+
35
+ [tool.setuptools_scm]
36
+ write_to = "vlak/_version.py"
37
+ fallback_version = "0.0.0"
vlak-1.0.0/run.py ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python3
2
+ from vlak.vlak import main
3
+
4
+ if __name__ == '__main__':
5
+ main()
vlak-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '1.0.0'
22
+ __version_tuple__ = version_tuple = (1, 0, 0)
23
+
24
+ __commit_id__ = commit_id = 'g7bd35e146'
@@ -0,0 +1,37 @@
1
+ import os
2
+ import arcade
3
+
4
+
5
+ class AudioManager:
6
+ LOKO = 0
7
+ BELL = 1
8
+ HORN = 2
9
+ CRASH = 3
10
+ WAGON = 4
11
+
12
+ def __init__(self, res_path: str):
13
+ self._sounds: dict[int, arcade.Sound] = {}
14
+ pairs = [
15
+ (self.LOKO, 'sounds/loko.wav'),
16
+ (self.BELL, 'sounds/bell.wav'),
17
+ (self.HORN, 'sounds/horn.wav'),
18
+ (self.CRASH, 'sounds/crash.wav'),
19
+ (self.WAGON, 'sounds/vagon.wav'),
20
+ ]
21
+ for index, rel in pairs:
22
+ path = os.path.join(res_path, rel)
23
+ if os.path.exists(path):
24
+ try:
25
+ self._sounds[index] = arcade.Sound(path)
26
+ except Exception as e:
27
+ print(f'Sound load failed {path}: {e}')
28
+
29
+ def play(self, index: int, silent: bool = False) -> None:
30
+ if silent:
31
+ return
32
+ sound = self._sounds.get(index)
33
+ if sound:
34
+ try:
35
+ sound.play()
36
+ except Exception:
37
+ pass
@@ -0,0 +1,91 @@
1
+ from collections import deque
2
+ from .constants import GRID_W, GRID_H, DDX, DDY, RIGHT, LEFT, UP, DOWN, STOP, is_collectible
3
+ from .constants import Tile
4
+
5
+
6
+ def auto_direction(loko_x: int, loko_y: int, mapa: list[list[int]],
7
+ wagons: list, door_open: bool, current_dir: int) -> int:
8
+ tx, ty = _find_target(loko_x, loko_y, mapa, door_open)
9
+ if tx < 0:
10
+ return current_dir
11
+
12
+ blocked = _build_blocked(mapa, wagons)
13
+ came_from = _bfs(loko_x, loko_y, tx, ty, blocked)
14
+
15
+ if came_from is None:
16
+ dxt = tx - loko_x
17
+ dyt = ty - loko_y
18
+ if abs(dxt) >= abs(dyt):
19
+ return RIGHT if dxt > 0 else LEFT
20
+ return DOWN if dyt > 0 else UP
21
+
22
+ return _trace_first_step(loko_x, loko_y, tx, ty, came_from)
23
+
24
+
25
+ def _find_target(loko_x: int, loko_y: int, mapa: list[list[int]],
26
+ door_open: bool) -> tuple[int, int]:
27
+ tx, ty = -1, -1
28
+ best = 9999
29
+ for j in range(GRID_H):
30
+ for i in range(GRID_W):
31
+ v = mapa[j][i]
32
+ if is_collectible(v):
33
+ d = abs(loko_x - i) + abs(loko_y - j)
34
+ if d < best:
35
+ best = d
36
+ tx, ty = i, j
37
+
38
+ if tx >= 0:
39
+ return tx, ty
40
+
41
+ if door_open:
42
+ for j in range(GRID_H):
43
+ for i in range(GRID_W):
44
+ if mapa[j][i] == Tile.DOOR:
45
+ return i, j
46
+
47
+ return -1, -1
48
+
49
+
50
+ def _build_blocked(mapa: list[list[int]], wagons: list) -> list[list[bool]]:
51
+ blocked = [[False] * GRID_W for _ in range(GRID_H)]
52
+ for j in range(GRID_H):
53
+ for i in range(GRID_W):
54
+ if mapa[j][i] == Tile.WALL:
55
+ blocked[j][i] = True
56
+ for w in wagons:
57
+ if 0 <= w.y < GRID_H and 0 <= w.x < GRID_W:
58
+ blocked[w.y][w.x] = True
59
+ return blocked
60
+
61
+
62
+ def _bfs(sx: int, sy: int, tx: int, ty: int,
63
+ blocked: list[list[bool]]) -> list[list[int]] | None:
64
+ came_from = [[-1] * GRID_W for _ in range(GRID_H)]
65
+ came_from[sy][sx] = 4 # sentinel: start
66
+ q = deque([(sx, sy)])
67
+ while q:
68
+ cx, cy = q.popleft()
69
+ for d in range(4):
70
+ nx, ny = cx + DDX[d], cy + DDY[d]
71
+ if nx < 0 or nx >= GRID_W or ny < 0 or ny >= GRID_H:
72
+ continue
73
+ if came_from[ny][nx] >= 0 or blocked[ny][nx]:
74
+ continue
75
+ came_from[ny][nx] = d
76
+ if nx == tx and ny == ty:
77
+ return came_from
78
+ q.append((nx, ny))
79
+ return None
80
+
81
+
82
+ def _trace_first_step(sx: int, sy: int, tx: int, ty: int,
83
+ came_from: list[list[int]]) -> int:
84
+ cx, cy = tx, ty
85
+ while True:
86
+ d = came_from[cy][cx]
87
+ px = cx + DDX[(d + 2) % 4]
88
+ py = cy + DDY[(d + 2) % 4]
89
+ if px == sx and py == sy:
90
+ return d
91
+ cx, cy = px, py
@@ -0,0 +1,51 @@
1
+ from enum import IntEnum
2
+
3
+ TILE_SIZE = 32
4
+ GRID_W = 20
5
+ GRID_H = 12
6
+ BASE_W = TILE_SIZE * GRID_W # 640
7
+ BASE_H = TILE_SIZE * GRID_H # 384
8
+
9
+ STEP_MS = 450
10
+ ANIM_MS = 150
11
+
12
+ RIGHT = 0
13
+ UP = 1
14
+ LEFT = 2
15
+ DOWN = 3
16
+ STOP = 4
17
+
18
+ DDX = [1, 0, -1, 0]
19
+ DDY = [0, -1, 0, 1]
20
+
21
+
22
+ class Tile(IntEnum):
23
+ EMPTY = 0
24
+ WALL = 1
25
+ # collectibles 100-118
26
+ KRY = 100
27
+ KOR = 101
28
+ STO = 102
29
+ JAB = 103
30
+ KRA = 104
31
+ TRE = 105
32
+ RYB = 106
33
+ ZIR = 107
34
+ ZMR = 108
35
+ DOR = 109
36
+ POC = 110
37
+ AUT = 111
38
+ BAL = 112
39
+ BUD = 113
40
+ SLO = 114
41
+ VIN = 115
42
+ PEN = 116
43
+ LET = 117
44
+ LEM = 118
45
+ # special
46
+ DOOR = 1000
47
+ LOKO = 10000
48
+
49
+
50
+ def is_collectible(v: int) -> bool:
51
+ return 100 <= v < 1000
@@ -0,0 +1,299 @@
1
+ import time
2
+ import arcade
3
+ from arcade import key as AKey
4
+ from .constants import (
5
+ GRID_W, GRID_H, TILE_SIZE, BASE_W, BASE_H,
6
+ STEP_MS, ANIM_MS,
7
+ RIGHT, UP, LEFT, DOWN, STOP,
8
+ Tile, is_collectible,
9
+ )
10
+ from .levels import LEVELS, PASSWORDS
11
+ from .train import Train, Wagon
12
+ from .audio import AudioManager
13
+ from .renderer import Renderer
14
+ from . import autopilot
15
+
16
+
17
+ class GameState:
18
+ def __init__(self):
19
+ self.mapa: list[list[int]] = []
20
+ self.train: Train = Train(0, 0)
21
+ self.anim: int = 0
22
+ self.door_anim: int = 0
23
+ self.crash_anim: int = 100
24
+ self.sub_step: float = 1.0
25
+ self.show_password: bool = False
26
+ self.level_password: str = ''
27
+ self.auto_pilot: bool = False
28
+ self.input_buffer: str = ''
29
+
30
+
31
+ class Game(arcade.Window):
32
+ def __init__(self, res_path: str, scale: int = 2):
33
+ win_w = BASE_W * scale
34
+ win_h = BASE_H * scale
35
+ super().__init__(win_w, win_h, 'Vlak',
36
+ antialiasing=False, vsync=True)
37
+ self.set_mouse_visible(False)
38
+
39
+ self._scale = scale
40
+ self._res_path = res_path
41
+ self._audio = AudioManager(res_path)
42
+ self._renderer = Renderer(res_path, win_w, win_h, scale)
43
+ self._state = GameState()
44
+
45
+ self._scene = 0
46
+ self._queued_dir = STOP
47
+ self._last_step = 0.0 # ms
48
+ self._last_anim = 0.0 # ms
49
+ self._key_anti = True
50
+
51
+ self._load_scene(0)
52
+
53
+ @staticmethod
54
+ def _now() -> float:
55
+ return time.perf_counter() * 1000.0
56
+
57
+ # ------------------------------------------------------------------
58
+ # Scene
59
+ # ------------------------------------------------------------------
60
+
61
+ def _load_scene(self, index: int) -> None:
62
+ self._scene = index
63
+ raw = LEVELS[index]
64
+ state = self._state
65
+
66
+ state.mapa = [row[:] for row in raw]
67
+ state.anim = 0
68
+ state.door_anim = 0
69
+ state.crash_anim = 100
70
+ state.show_password = False
71
+ state.level_password = PASSWORDS[index] if index < len(PASSWORDS) else ''
72
+ state.auto_pilot = (index == 0)
73
+ state.input_buffer = ''
74
+
75
+ lx, ly = 0, 0
76
+ for j in range(GRID_H):
77
+ for i in range(GRID_W):
78
+ if state.mapa[j][i] == Tile.LOKO:
79
+ state.mapa[j][i] = Tile.EMPTY
80
+ lx, ly = i, j
81
+
82
+ state.train = Train(loko_x=lx, loko_y=ly)
83
+ state.train.prev_x = lx
84
+ state.train.prev_y = ly
85
+ state.sub_step = 1.0
86
+ self._queued_dir = STOP
87
+ self._last_step = 0.0
88
+ self._last_anim = self._now()
89
+
90
+ # ------------------------------------------------------------------
91
+ # Arcade callbacks
92
+ # ------------------------------------------------------------------
93
+
94
+ def on_draw(self) -> None:
95
+ self.clear((0, 0, 0))
96
+ self._renderer.draw(self._state)
97
+
98
+ def on_update(self, delta_time: float) -> None:
99
+ self._update()
100
+
101
+ def on_key_press(self, key: int, modifiers: int) -> None:
102
+ state = self._state
103
+
104
+ if state.auto_pilot and key == AKey.SPACE:
105
+ self._load_scene(1)
106
+ return
107
+
108
+ if key == AKey.ESCAPE:
109
+ self.close()
110
+ return
111
+
112
+ if modifiers & AKey.MOD_ALT:
113
+ scale_map = {AKey.KEY_1: 1, AKey.KEY_2: 2, AKey.KEY_3: 3, AKey.KEY_4: 4}
114
+ if key in scale_map:
115
+ self._set_scale(scale_map[key])
116
+ return
117
+
118
+ dir_map = {
119
+ AKey.RIGHT: RIGHT, AKey.LEFT: LEFT,
120
+ AKey.UP: UP, AKey.DOWN: DOWN,
121
+ }
122
+ if key in dir_map:
123
+ self._queued_dir = dir_map[key]
124
+ return
125
+
126
+ if key in (AKey.RETURN, AKey.SPACE):
127
+ self._handle_confirm()
128
+ return
129
+
130
+ if key == AKey.BACKSPACE:
131
+ if state.input_buffer:
132
+ state.input_buffer = state.input_buffer[:-1]
133
+ return
134
+
135
+ if AKey.A <= key <= AKey.Z and self._key_anti:
136
+ self._key_anti = False
137
+ if len(state.input_buffer) >= 5:
138
+ state.input_buffer = ''
139
+ state.input_buffer += chr(key - AKey.A + ord('A'))
140
+
141
+ def on_key_release(self, key: int, modifiers: int) -> None:
142
+ self._key_anti = True
143
+
144
+ # ------------------------------------------------------------------
145
+ # Input helpers
146
+ # ------------------------------------------------------------------
147
+
148
+ def _handle_confirm(self) -> None:
149
+ state = self._state
150
+ buf = state.input_buffer
151
+ if buf:
152
+ for i, pw in enumerate(PASSWORDS):
153
+ if buf == pw:
154
+ self._load_scene(i + 1)
155
+ break
156
+ state.input_buffer = ''
157
+ elif state.show_password and self._scene < len(LEVELS) - 1:
158
+ self._load_scene(self._scene + 1)
159
+ else:
160
+ self._load_scene(self._scene)
161
+
162
+ def _set_scale(self, scale: int) -> None:
163
+ scale = max(1, min(4, scale))
164
+ self._scale = scale
165
+ self.set_size(BASE_W * scale, BASE_H * scale)
166
+ self._renderer = Renderer(
167
+ self._res_path, BASE_W * scale, BASE_H * scale, scale)
168
+
169
+ # ------------------------------------------------------------------
170
+ # Update loop
171
+ # ------------------------------------------------------------------
172
+
173
+ def _update(self) -> None:
174
+ now = self._now()
175
+ state = self._state
176
+ train = state.train
177
+
178
+ # animation tick
179
+ if now - self._last_anim >= ANIM_MS:
180
+ self._last_anim += ANIM_MS
181
+ state.anim = (state.anim + 1) % 3
182
+ if state.door_anim and state.door_anim < 5:
183
+ state.door_anim += 1
184
+ if state.crash_anim < 100:
185
+ state.crash_anim += 1
186
+ if state.crash_anim == 10:
187
+ state.crash_anim = 7
188
+
189
+ # auto-advance demo scene
190
+ if state.auto_pilot and state.show_password and state.sub_step >= 1.0:
191
+ self._load_scene(1)
192
+ return
193
+
194
+ crashed = state.crash_anim < 100
195
+
196
+ if crashed or state.show_password:
197
+ if state.show_password and state.sub_step < 1.0:
198
+ state.sub_step = (now - self._last_step) / STEP_MS
199
+ if state.sub_step > 1.0:
200
+ state.sub_step = 1.0
201
+ else:
202
+ self._last_step = now
203
+ state.sub_step = 1.0
204
+ train.prev_x = train.loko_x
205
+ train.prev_y = train.loko_y
206
+ return
207
+
208
+ if state.auto_pilot:
209
+ self._queued_dir = autopilot.auto_direction(
210
+ train.loko_x, train.loko_y,
211
+ state.mapa, train.wagons,
212
+ bool(state.door_anim), train.direction)
213
+
214
+ if train.direction == STOP:
215
+ if self._queued_dir != STOP:
216
+ train.direction = self._queued_dir
217
+ self._queued_dir = STOP
218
+ train.snapshot()
219
+ self._step()
220
+ state.sub_step = 0.0
221
+ self._last_step = now
222
+ else:
223
+ state.sub_step = (now - self._last_step) / STEP_MS
224
+ if state.sub_step >= 1.0:
225
+ if self._queued_dir != STOP:
226
+ train.direction = self._queued_dir
227
+ self._queued_dir = STOP
228
+ train.snapshot()
229
+ self._step()
230
+ self._last_step = now
231
+ state.sub_step = 0.0
232
+
233
+ # ------------------------------------------------------------------
234
+ # Step (direct port of C control())
235
+ # ------------------------------------------------------------------
236
+
237
+ def _step(self) -> None:
238
+ state = self._state
239
+ train = state.train
240
+ mute = state.auto_pilot
241
+ from .constants import DDX, DDY
242
+
243
+ old_x, old_y = train.loko_x, train.loko_y
244
+ new_x = old_x + DDX[train.direction]
245
+ new_y = old_y + DDY[train.direction]
246
+ tile = state.mapa[new_y][new_x]
247
+
248
+ if tile == Tile.DOOR:
249
+ if state.door_anim:
250
+ state.show_password = True
251
+ self._audio.play(AudioManager.HORN, silent=mute)
252
+ else:
253
+ state.crash_anim = 0
254
+ self._audio.play(AudioManager.CRASH, silent=mute)
255
+ return
256
+ elif tile == Tile.WALL:
257
+ state.crash_anim = 0
258
+ self._audio.play(AudioManager.CRASH, silent=mute)
259
+ return
260
+ elif train.collides_with_self(new_x, new_y):
261
+ state.crash_anim = 0
262
+ self._audio.play(AudioManager.CRASH, silent=mute)
263
+ return
264
+
265
+ train.loko_x = new_x
266
+ train.loko_y = new_y
267
+
268
+ m = len(train.wagons) # old count, saved before possible append
269
+
270
+ if is_collectible(tile):
271
+ self._audio.play(AudioManager.WAGON, silent=mute)
272
+ cargo = tile - 100
273
+ if train.wagons:
274
+ tail = train.wagons[-1]
275
+ train.wagons.append(Wagon(tail.x, tail.y, 0, cargo))
276
+ else:
277
+ train.wagons.append(Wagon(old_x, old_y, 0, cargo))
278
+ state.mapa[new_y][new_x] = Tile.EMPTY
279
+ if not any(is_collectible(state.mapa[j][i])
280
+ for j in range(GRID_H) for i in range(GRID_W)):
281
+ state.door_anim = 1
282
+ self._audio.play(AudioManager.BELL, silent=mute)
283
+
284
+ # C: while(m) { vagony[m]=vagony[m-1]; m-- }
285
+ i = m
286
+ while i > 0:
287
+ if i < len(train.wagons):
288
+ train.wagons[i].x = train.wagons[i - 1].x
289
+ train.wagons[i].y = train.wagons[i - 1].y
290
+ train.wagons[i].direction = train.wagons[i - 1].direction
291
+ i -= 1
292
+ if train.wagons:
293
+ train.wagons[0].x = old_x
294
+ train.wagons[0].y = old_y
295
+ train.wagons[0].direction = train.loko_dir
296
+
297
+ if train.direction != STOP:
298
+ train.loko_dir = train.direction
299
+ self._audio.play(AudioManager.LOKO, silent=mute)
@@ -0,0 +1,3 @@
1
+ LEVELS = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [100, 0, 0, 0, 100, 102, 0, 0, 0, 0, 0, 0, 101, 0, 0, 103, 0, 0, 0, 103], [100, 0, 0, 0, 100, 102, 0, 0, 0, 0, 0, 101, 0, 101, 0, 103, 0, 0, 103, 0], [100, 0, 0, 0, 100, 102, 0, 0, 0, 0, 101, 0, 0, 0, 101, 103, 0, 103, 0, 0], [100, 0, 0, 0, 100, 102, 0, 0, 0, 0, 101, 0, 0, 0, 101, 103, 103, 0, 0, 0], [100, 0, 0, 0, 100, 102, 0, 0, 0, 0, 101, 101, 101, 101, 101, 103, 0, 103, 0, 0], [0, 100, 0, 100, 0, 102, 0, 0, 0, 0, 101, 0, 0, 0, 101, 103, 0, 0, 103, 0], [0, 0, 100, 0, 0, 102, 102, 102, 102, 102, 101, 0, 0, 0, 101, 103, 0, 0, 0, 103], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 100, 100, 100, 100, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 100, 0, 100, 0, 100, 0, 100, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 101, 0, 101, 0, 101, 0, 101, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 101, 101, 101, 101, 101, 101, 101, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 101, 101, 101, 101, 101, 101, 101, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 101, 101, 101, 101, 101, 101, 101, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 100, 100, 100, 0, 0, 0, 0, 1, 0, 0, 0, 102, 0, 102, 0, 0, 0, 1], [1, 0, 100, 101, 100, 0, 0, 0, 0, 1, 0, 0, 102, 0, 102, 0, 102, 0, 0, 1], [1, 0, 100, 100, 100, 0, 0, 0, 0, 1, 0, 0, 0, 102, 0, 102, 0, 0, 0, 1], [1, 0, 0, 100, 0, 0, 0, 0, 0, 1000, 0, 0, 102, 0, 102, 0, 102, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 102, 0, 102, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 10000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 103, 103, 103, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 103, 103, 102, 103, 103, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 103, 103, 102, 1, 102, 103, 103, 0, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 0, 103, 103, 102, 103, 1, 103, 102, 103, 103, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 103, 103, 102, 103, 103, 103, 103, 103, 102, 103, 103, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 104, 0, 104, 0, 104, 0, 1, 0, 0, 104, 0, 104, 0, 104, 0, 0, 1], [1, 10000, 0, 0, 104, 0, 104, 0, 0, 1, 0, 0, 0, 104, 0, 104, 0, 0, 0, 1], [1, 0, 0, 104, 0, 104, 0, 104, 0, 1, 0, 0, 104, 0, 104, 0, 104, 0, 0, 1], [1, 0, 0, 0, 104, 0, 104, 0, 0, 1, 0, 0, 0, 104, 0, 104, 0, 0, 0, 1], [1000, 0, 0, 104, 0, 104, 0, 104, 0, 1, 0, 0, 104, 0, 104, 0, 104, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 105, 105, 105, 0, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 0, 1, 0, 100, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 0, 0, 105, 105, 101, 105, 105, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 105, 105, 105, 0, 0, 1, 0, 100, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 100, 0, 0, 0, 1], [1000, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 100, 0, 0, 0, 102, 102, 102, 0, 0, 0, 104, 0, 104, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 102, 0, 106, 0, 102, 0, 0, 0, 0, 0, 0, 0, 1], [1, 10000, 0, 0, 100, 0, 0, 102, 106, 0, 106, 102, 0, 0, 0, 104, 0, 104, 0, 1], [1, 0, 0, 0, 1, 0, 0, 102, 0, 106, 0, 102, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 100, 0, 0, 102, 106, 0, 106, 102, 0, 0, 104, 0, 104, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 102, 0, 1, 0, 102, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 100, 0, 0, 0, 102, 1, 102, 0, 0, 0, 0, 104, 0, 104, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 0, 0, 102, 0, 102, 0, 0, 1, 0, 100, 0, 0, 0, 1], [1, 10000, 0, 100, 0, 1, 0, 103, 0, 107, 0, 103, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 0, 0, 102, 0, 102, 0, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 0, 0, 0, 106, 0, 0, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 0, 102, 0, 0, 0, 102, 0, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 100, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 100, 100, 0, 0, 1, 0, 108, 108, 0, 1, 0, 0, 100, 100, 0, 0, 1], [1, 0, 100, 100, 100, 100, 0, 1, 0, 108, 108, 0, 1, 0, 100, 100, 100, 100, 0, 1], [1, 0, 100, 100, 100, 100, 0, 1, 0, 108, 108, 0, 1, 0, 100, 100, 100, 100, 0, 1], [1, 0, 0, 100, 100, 0, 0, 1, 0, 108, 108, 0, 1, 0, 0, 100, 100, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 102, 0, 0, 0, 108, 0, 108, 0, 108, 0, 0, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 0, 0, 0, 108, 0, 108, 0, 0, 0, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 1, 0, 0, 0, 100, 0, 0, 0, 1, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 1, 0, 0, 0, 101, 0, 0, 0, 1, 0, 102, 0, 0, 0, 1], [1, 10000, 0, 106, 0, 1, 0, 0, 1, 1000, 1, 0, 0, 1, 0, 107, 0, 0, 0, 1], [1, 0, 0, 102, 0, 1, 104, 0, 1, 109, 1, 0, 104, 1, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 1, 0, 0, 1, 100, 1, 0, 0, 1, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 1, 0, 0, 1, 100, 1, 0, 0, 1, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 1, 0, 0, 1, 100, 1, 0, 0, 1, 0, 102, 0, 0, 0, 1], [1, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 106, 0, 1, 1, 0, 106, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 110, 110, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 110, 110, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 110, 110, 0, 0, 1], [1, 0, 0, 110, 110, 0, 1, 0, 0, 101, 101, 0, 0, 1, 0, 110, 110, 0, 0, 1], [1, 10000, 0, 110, 0, 0, 0, 1000, 0, 0, 0, 0, 101, 0, 0, 0, 110, 0, 0, 1], [1, 0, 0, 110, 0, 1, 102, 1, 110, 0, 0, 110, 1, 102, 1, 0, 110, 0, 0, 1], [1, 0, 0, 110, 0, 1, 102, 1, 0, 110, 110, 0, 1, 102, 1, 0, 110, 0, 0, 1], [1, 0, 110, 110, 0, 1, 102, 1, 0, 110, 110, 0, 1, 102, 1, 0, 110, 110, 0, 1], [1, 0, 110, 110, 0, 1, 102, 1, 110, 110, 110, 110, 1, 102, 1, 0, 110, 110, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 0, 1], [1, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 1], [1, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 1], [1, 10000, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 1], [1, 0, 104, 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 0, 104, 0, 1], [1, 0, 104, 0, 1, 1, 1, 1, 1, 111, 1, 1, 1, 1, 1, 1, 0, 104, 0, 1], [1, 0, 104, 0, 1, 111, 111, 111, 111, 0, 111, 111, 111, 111, 111, 1, 0, 104, 0, 1], [1, 0, 104, 0, 1, 111, 111, 111, 111, 0, 111, 111, 111, 111, 111, 1, 0, 104, 0, 1], [1, 0, 0, 0, 1, 111, 111, 111, 111, 0, 111, 111, 111, 111, 111, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 108, 108, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103, 103, 1], [1, 1, 108, 108, 108, 1, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, 103, 103, 1], [1, 1, 108, 108, 108, 1, 0, 0, 112, 0, 112, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 1, 1, 108, 108, 1, 0, 0, 0, 112, 0, 107, 102, 101, 0, 0, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 104, 102, 1, 1, 0, 100, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 107, 102, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 104, 102, 1, 1, 1, 100, 0, 100, 0, 0, 0, 0, 109, 1], [1, 0, 0, 0, 107, 102, 1, 1, 1, 100, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 0, 102, 1, 1, 1, 100, 0, 0, 100, 0, 100, 0, 100, 0, 0, 103, 103, 1], [1, 0, 104, 1, 1, 0, 0, 0, 100, 0, 0, 0, 111, 111, 111, 0, 0, 103, 103, 1], [1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 113, 113, 113, 0, 113, 0, 113, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 113, 0, 0, 113, 0, 113, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 113, 0, 0, 113, 0, 113, 113, 0, 0, 0, 113, 113, 113, 0, 0, 0, 0, 1], [1, 0, 113, 0, 0, 113, 0, 113, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1000, 10000, 113, 0, 0, 113, 0, 113, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 113, 113, 113, 0, 0, 113, 0, 0, 113, 0, 113, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 113, 0, 113, 0, 113, 113, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 113, 113, 113, 0, 113, 0, 113, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 113, 0, 113, 0, 113, 0, 113, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 1, 101, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 114, 102, 114, 0, 0, 0, 0, 106, 102, 106, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 102, 114, 102, 0, 1, 105, 0, 102, 106, 102, 1, 0, 0, 0, 1], [1, 10000, 0, 0, 1000, 1, 1, 1, 110, 103, 1, 111, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 108, 103, 1, 108, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 102, 107, 102, 109, 1, 108, 109, 102, 104, 102, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 107, 102, 107, 109, 109, 109, 109, 104, 102, 104, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 115, 115, 115, 115, 115, 115, 115, 115, 115, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 115, 115, 115, 115, 115, 115, 115, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 115, 115, 115, 115, 115, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 115, 115, 115, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 10000, 0, 0, 0, 0, 0, 1, 1000, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 101, 101, 101, 101, 101, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 100, 101, 100, 101, 111, 111, 111, 111, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 101, 100, 101, 100, 1, 1, 1, 1, 116, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 100, 101, 1, 101, 1, 116, 116, 116, 116, 1, 116, 116, 116, 1, 0, 0, 0, 0, 1], [1, 101, 100, 101, 100, 1, 116, 1, 1, 1, 1, 116, 1, 116, 1, 0, 0, 0, 0, 1], [1, 100, 101, 100, 101, 1, 116, 116, 116, 116, 116, 116, 1, 116, 1, 0, 0, 0, 0, 1], [1, 10000, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 116, 116, 1, 0, 0, 0, 0, 1], [1, 100, 101, 100, 101, 1, 116, 116, 116, 116, 1, 116, 116, 1, 1, 0, 0, 0, 0, 1], [1, 101, 1, 1, 100, 1, 116, 1, 1, 116, 116, 116, 116, 116, 1, 0, 0, 0, 0, 1], [1, 100, 101, 100, 101, 1, 116, 116, 116, 1, 1, 1, 116, 116, 1, 0, 0, 0, 0, 1], [1, 101, 100, 101, 100, 1, 116, 116, 116, 116, 116, 116, 116, 101, 1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 1], [1, 0, 109, 0, 0, 1, 117, 0, 1, 0, 1, 0, 117, 1, 0, 0, 0, 108, 0, 1], [1, 0, 109, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 108, 108, 0, 1], [1, 0, 109, 109, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 108, 108, 108, 0, 1], [1, 0, 109, 109, 0, 0, 100, 0, 0, 107, 0, 0, 100, 0, 108, 108, 108, 108, 0, 1], [1, 10000, 109, 109, 0, 0, 100, 0, 0, 114, 0, 0, 100, 0, 108, 108, 108, 108, 0, 1], [1, 0, 109, 109, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 108, 108, 108, 0, 1], [1, 0, 109, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 108, 108, 0, 1], [1, 0, 109, 0, 0, 1, 117, 0, 1, 0, 1, 0, 117, 1, 0, 0, 0, 108, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 10000, 100, 100, 100, 100, 100, 100, 1000, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 114, 114, 114, 114, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 100, 0, 1, 0, 0, 1, 102, 107, 102, 107, 1, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 0, 0, 0, 1, 1, 102, 107, 102, 107, 102, 107, 1, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 0, 0, 102, 107, 102, 107, 102, 107, 102, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 107, 102, 107, 102, 107, 102, 107, 102, 1, 100, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 107, 102, 107, 102, 107, 102, 107, 1000, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1], [1, 105, 103, 105, 103, 105, 103, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 103, 105, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 102, 102, 102, 102, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 102, 102, 102, 102, 1], [1, 0, 110, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 110, 0, 1], [1, 113, 0, 109, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 109, 0, 113, 1], [1, 1, 1, 1, 108, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 108, 1, 1, 1, 1], [1, 0, 0, 0, 1, 108, 0, 0, 0, 1, 1, 0, 0, 0, 108, 1, 0, 0, 0, 1], [1, 100, 100, 0, 0, 1, 108, 0, 0, 10000, 0, 0, 0, 108, 1, 0, 0, 100, 100, 1], [1, 100, 1, 100, 0, 0, 1, 108, 0, 115, 115, 0, 108, 1, 0, 0, 100, 1, 100, 1], [1, 0, 0, 1, 100, 0, 0, 1, 0, 115, 115, 0, 1, 0, 0, 100, 1, 0, 0, 1], [1, 0, 101, 0, 1, 100, 0, 0, 1, 115, 115, 1, 0, 0, 100, 1, 0, 101, 0, 1], [1, 0, 0, 0, 0, 1, 100, 0, 0, 115, 115, 0, 0, 100, 1, 0, 0, 0, 0, 1000], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 10000, 102, 102, 102, 102, 102, 102, 0, 102, 1, 102, 0, 102, 102, 102, 102, 102, 102, 1], [1, 0, 102, 102, 102, 102, 102, 102, 102, 102, 1, 102, 102, 102, 102, 102, 102, 102, 102, 1], [1, 102, 102, 102, 102, 102, 102, 0, 102, 0, 1, 0, 102, 0, 102, 102, 102, 102, 102, 1], [1, 0, 102, 102, 102, 102, 0, 102, 1, 1, 1, 1, 1, 102, 0, 102, 0, 102, 102, 1], [1, 102, 102, 102, 102, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 102, 102, 102, 1], [1, 0, 102, 102, 102, 0, 1, 0, 1, 0, 106, 0, 1, 0, 1, 0, 102, 102, 102, 1], [1, 0, 0, 102, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 102, 0, 1], [1, 0, 102, 102, 102, 102, 1, 0, 1, 1, 0, 1, 1, 0, 1, 102, 102, 102, 102, 1], [1, 102, 102, 102, 102, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 102, 102, 102, 1], [1000, 0, 102, 0, 102, 0, 1, 102, 102, 102, 107, 102, 102, 102, 1, 0, 102, 0, 102, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 115, 115, 115, 115, 0, 0, 115, 115, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 115, 1, 1, 1, 1, 115, 0, 115, 115, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 115, 1, 1, 1, 1, 1, 1, 115, 115, 115, 0, 0, 0, 0, 0, 0, 1], [1, 0, 115, 1, 1, 1, 1, 1, 1, 1, 1, 115, 115, 0, 0, 0, 0, 0, 0, 1], [1, 10000, 115, 1, 1, 112, 112, 112, 1, 1, 1, 1, 115, 0, 0, 0, 0, 0, 0, 1], [1, 0, 115, 1, 1, 112, 117, 112, 108, 108, 108, 1, 115, 0, 102, 0, 102, 0, 102, 1], [1, 0, 115, 1, 1, 112, 112, 112, 108, 108, 108, 1, 115, 102, 102, 102, 102, 102, 102, 1], [1, 0, 115, 1, 1, 1, 1, 1, 108, 108, 108, 1, 115, 0, 102, 0, 102, 0, 102, 1], [1, 0, 115, 1, 1, 1, 1, 1, 108, 108, 1, 1, 115, 0, 102, 0, 102, 0, 102, 1], [1, 0, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 0, 102, 0, 102, 0, 102, 1000], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 105, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 105, 0, 1], [1, 0, 105, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 105, 0, 1], [1, 1, 1, 1, 0, 1, 0, 1, 0, 106, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1], [1, 0, 105, 0, 0, 1, 0, 1, 0, 107, 0, 1, 0, 1, 0, 0, 0, 105, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 105, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 105, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1, 1, 10000, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 105, 0, 0, 1, 0, 0, 103, 0, 103, 0, 0, 1, 0, 0, 0, 105, 0, 1], [1, 0, 0, 0, 0, 1, 102, 0, 0, 0, 0, 0, 102, 1, 0, 0, 0, 0, 0, 1], [1, 0, 105, 0, 0, 1, 103, 103, 103, 103, 103, 103, 103, 1, 0, 0, 0, 105, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 10000, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1], [1, 0, 101, 0, 101, 0, 101, 0, 101, 0, 0, 101, 0, 101, 0, 101, 0, 101, 0, 1], [1, 1, 109, 109, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 0, 101, 0, 0, 101, 0, 109, 109, 1, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 1, 109, 1, 109, 109, 1, 109, 109, 1, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 1, 109, 1, 109, 109, 1, 109, 109, 1, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 1, 109, 1, 109, 109, 1, 109, 109, 1, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 1, 109, 1, 109, 109, 1, 109, 109, 1, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 1, 109, 1, 109, 109, 1, 109, 109, 1, 109, 109, 1, 1], [1, 1, 109, 109, 1, 109, 109, 1, 109, 1, 109, 109, 1, 109, 109, 1, 109, 109, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 103, 0, 105, 0, 1, 1, 1, 1], [1, 1, 107, 114, 107, 1, 0, 0, 0, 102, 102, 106, 115, 103, 1, 105, 0, 1, 1, 1], [1, 1, 114, 107, 114, 0, 0, 0, 102, 1, 1, 102, 106, 115, 103, 1, 105, 0, 1, 1], [1, 1, 107, 114, 107, 0, 0, 102, 1, 0, 0, 1, 102, 106, 115, 103, 1, 105, 0, 1], [1, 1, 114, 107, 114, 0, 102, 1, 0, 0, 0, 0, 1, 102, 106, 115, 103, 1, 0, 1], [1, 1, 1, 1, 0, 102, 1, 0, 0, 0, 0, 0, 0, 1, 102, 106, 115, 103, 0, 1], [1, 0, 0, 0, 102, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 102, 106, 115, 103, 1], [1, 0, 0, 102, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 102, 106, 115, 1], [1, 0, 102, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 102, 106, 1], [1, 102, 10000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1000, 102, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 10000, 100, 1, 1, 0, 100, 0, 0, 1, 0, 0, 100, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 1, 0, 1, 100, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 0, 0, 100, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 100, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 100, 1, 1000, 1, 0, 100, 0, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 101, 0, 100, 0, 1, 100, 0, 0, 0, 0, 1], [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 100, 1, 0, 1, 100, 100, 0, 1], [1, 0, 0, 0, 0, 1, 0, 100, 0, 1, 0, 100, 0, 1, 0, 100, 0, 0, 1, 1], [1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 100, 0, 0, 1, 0, 1], [1, 0, 100, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 107, 107, 1, 0, 0, 0, 0, 0, 0, 1, 107, 107, 1, 0, 0, 1], [1, 0, 1, 107, 107, 107, 107, 1, 0, 1, 1, 0, 1, 107, 107, 107, 107, 1, 0, 1], [1, 10000, 1, 107, 107, 107, 0, 0, 0, 114, 114, 0, 0, 0, 107, 107, 107, 1, 0, 1], [1, 0, 1, 107, 107, 107, 0, 107, 114, 114, 114, 114, 1, 0, 107, 107, 107, 1, 0, 1], [1, 0, 1, 107, 107, 107, 107, 1, 1, 1, 1, 1, 1, 107, 107, 107, 107, 1, 0, 1], [1, 0, 0, 1, 107, 107, 1, 0, 0, 0, 0, 0, 0, 1, 107, 107, 1, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 107, 0, 1, 0, 104, 0, 0, 1, 0, 114, 0, 1, 0, 107, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 10000, 1, 0, 1, 1, 1, 0, 1, 1, 1], [1, 102, 0, 0, 0, 102, 0, 0, 0, 0, 102, 0, 0, 0, 102, 0, 0, 0, 102, 1], [1, 102, 0, 0, 0, 102, 0, 0, 0, 0, 102, 0, 0, 0, 102, 0, 0, 0, 102, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1000, 1, 0, 1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 104, 0, 1, 0, 114, 0, 1, 0, 0, 107, 0, 1, 0, 104, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1], [1, 0, 0, 1, 113, 113, 113, 113, 113, 1, 1, 100, 100, 100, 100, 100, 1, 0, 0, 1], [1, 0, 0, 1, 106, 1, 106, 106, 106, 1, 1, 101, 101, 101, 1, 101, 1, 0, 0, 1], [1, 0, 0, 1, 108, 1, 1, 108, 108, 1, 1, 103, 103, 1, 1, 103, 1, 0, 0, 1], [1, 0, 0, 1, 117, 111, 1, 1, 111, 1, 1, 110, 1, 1, 110, 110, 1, 0, 0, 1], [1, 0, 0, 1, 109, 109, 109, 1, 109, 1, 1, 104, 1, 104, 104, 104, 1, 0, 0, 1], [1, 0, 0, 1, 112, 112, 112, 112, 112, 1, 1, 115, 115, 115, 115, 115, 1, 0, 0, 1], [1, 0, 0, 1, 1, 1, 1, 102, 102, 1, 1, 102, 102, 1, 1, 1, 1, 0, 0, 1], [1, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 100, 0, 100, 0, 100, 0, 100, 102, 102, 100, 0, 100, 0, 100, 0, 100, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 100, 0, 100, 0, 100, 0, 100, 102, 102, 100, 0, 100, 0, 100, 0, 100, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 10000, 100, 0, 100, 0, 100, 0, 100, 102, 102, 100, 0, 100, 0, 100, 0, 100, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 100, 0, 100, 0, 100, 0, 100, 102, 102, 100, 0, 100, 0, 100, 0, 100, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 100, 0, 100, 0, 100, 0, 100, 102, 102, 100, 0, 100, 0, 100, 0, 100, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 102, 102, 102, 102, 1, 1, 102, 102, 102, 102, 1, 102, 102, 1, 1], [1, 0, 0, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 102, 1], [1, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 1], [1, 102, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1], [1, 10000, 102, 1, 1, 102, 1, 1, 102, 1, 1, 102, 1, 1, 102, 1, 1, 102, 1, 1], [1, 102, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1], [1, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 1000], [1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 1], [1, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1], [1, 1, 1, 102, 102, 102, 102, 1, 1, 102, 102, 102, 102, 1, 1, 102, 102, 102, 102, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 108, 1, 1, 1, 108, 0, 0, 109, 109, 0, 0, 105, 105, 105, 105, 0, 0, 1], [1, 0, 108, 1, 1, 1, 108, 0, 109, 1, 1, 109, 0, 105, 1, 1, 1, 105, 0, 1], [1, 0, 0, 108, 1, 108, 0, 109, 1, 1, 1, 1, 109, 105, 1, 1, 1, 105, 0, 1], [1, 0, 0, 108, 1, 108, 0, 109, 1, 1, 1, 1, 109, 105, 1, 1, 1, 105, 0, 1], [1, 10000, 0, 0, 108, 0, 0, 109, 1, 1, 1, 1, 109, 105, 1, 1, 1, 105, 0, 1], [1, 0, 0, 0, 108, 0, 0, 109, 1, 1, 1, 1, 109, 105, 105, 105, 105, 0, 0, 1000], [1, 0, 0, 108, 1, 108, 0, 109, 1, 1, 1, 1, 109, 105, 1, 105, 0, 0, 0, 1], [1, 0, 0, 108, 1, 108, 0, 109, 1, 1, 1, 1, 109, 105, 1, 1, 105, 0, 0, 1], [1, 0, 108, 1, 1, 1, 108, 0, 109, 1, 1, 109, 0, 105, 1, 1, 1, 105, 0, 1], [1, 0, 108, 1, 1, 1, 108, 0, 0, 109, 109, 0, 0, 105, 1, 1, 1, 105, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 115, 115, 115, 115, 115, 115, 115, 115, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 115, 115, 115, 115, 115, 115, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 115, 115, 115, 115, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 1, 115, 115, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 115, 115, 115, 115, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 115, 115, 115, 115, 115, 115, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 115, 115, 115, 115, 115, 115, 115, 115, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 115, 115, 115, 115, 115, 115, 115, 115, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 104, 0, 107, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 104, 104, 0, 107, 107, 1, 0, 0, 0, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 1, 104, 104, 104, 0, 107, 107, 107, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 104, 104, 104, 0, 107, 107, 107, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 104, 104, 0, 107, 107, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 104, 0, 107, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 10000, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 1, 0, 101, 0, 1, 0, 101, 0, 1, 0, 101, 0, 1, 0, 101, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 101, 0, 1, 0, 101, 0, 1, 0, 101, 0, 1, 0, 101, 0, 1, 0, 1], [1, 1, 0, 100, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 100, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 105, 103, 103, 103, 105, 105, 103, 103, 103, 105, 1, 0, 0, 0, 1], [1, 0, 100, 0, 1, 105, 103, 1, 103, 105, 105, 103, 1, 103, 105, 1, 0, 100, 0, 1], [1, 0, 0, 0, 1, 103, 103, 1, 103, 103, 103, 103, 1, 103, 103, 1, 0, 0, 0, 1], [1, 10000, 100, 0, 102, 103, 1, 1, 1, 103, 103, 1, 1, 1, 103, 102, 0, 100, 0, 1000], [1, 0, 0, 0, 1, 103, 103, 1, 103, 103, 103, 103, 1, 103, 103, 1, 0, 0, 0, 1], [1, 0, 100, 0, 1, 105, 103, 1, 103, 105, 105, 103, 1, 103, 105, 1, 0, 100, 0, 1], [1, 0, 0, 0, 1, 105, 103, 103, 103, 105, 105, 103, 103, 103, 105, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 117, 0, 0, 0, 102, 1, 102, 102, 1, 102, 0, 0, 0, 117, 0, 0, 1], [1, 0, 0, 0, 0, 0, 102, 1, 0, 0, 0, 0, 1, 102, 0, 0, 0, 0, 0, 1], [1, 10000, 0, 0, 0, 102, 1, 0, 0, 1, 102, 0, 0, 1, 102, 0, 0, 0, 0, 1], [1, 0, 0, 0, 102, 1, 0, 0, 0, 1, 102, 0, 0, 0, 1, 102, 0, 0, 0, 1], [1, 0, 0, 102, 1, 102, 0, 102, 0, 0, 1, 0, 102, 0, 102, 1, 102, 0, 0, 1], [1, 0, 102, 1, 0, 0, 1, 1, 102, 102, 1, 102, 1, 1, 0, 0, 1, 102, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 102, 1000], [1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 110, 110, 110, 110, 110, 110, 1, 0, 0, 110, 110, 110, 110, 110, 110, 110, 1, 0, 1], [1, 0, 110, 110, 1, 0, 110, 110, 1, 0, 0, 110, 110, 1, 0, 0, 110, 1, 0, 1], [1, 0, 110, 110, 1, 0, 110, 110, 1, 0, 0, 110, 110, 1, 0, 0, 110, 1, 0, 1], [1, 0, 110, 110, 1, 0, 110, 110, 1, 0, 0, 110, 110, 1, 110, 1, 0, 0, 0, 1], [1, 0, 110, 110, 110, 110, 110, 1, 0, 0, 0, 110, 110, 110, 110, 1, 0, 0, 0, 1], [1, 0, 110, 110, 1, 0, 0, 0, 0, 0, 0, 110, 110, 1, 110, 1, 0, 0, 0, 1], [1, 0, 110, 110, 1, 0, 0, 0, 0, 0, 0, 110, 110, 1, 0, 0, 0, 0, 0, 1], [1, 0, 110, 110, 1, 0, 0, 0, 0, 0, 0, 110, 110, 1, 0, 0, 0, 0, 0, 1], [1, 110, 110, 110, 1, 1, 0, 0, 0, 0, 110, 110, 110, 1, 1, 0, 0, 0, 0, 1000], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 102, 102, 102, 102, 102, 102, 103, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 102, 102, 102, 102, 102, 102, 103, 103, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 102, 102, 102, 102, 102, 102, 103, 103, 103, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 1, 1, 1, 1, 1], [1, 1, 1, 1, 10000, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 104, 104, 104, 1, 104, 104, 104, 103, 103, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 104, 104, 104, 104, 104, 104, 104, 103, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 104, 104, 104, 104, 104, 104, 104, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 107, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 114, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 106, 1, 106, 1, 106, 1, 106, 1, 0, 0, 1, 106, 1, 106, 1, 106, 1, 106, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1, 1, 109, 1000, 1, 1, 1, 1, 1], [1, 1, 1, 1, 108, 108, 108, 108, 1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1], [1, 1, 1, 0, 108, 108, 108, 108, 0, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1], [1, 1, 1, 1, 104, 108, 108, 107, 107, 107, 107, 107, 107, 108, 108, 104, 1, 1, 1, 1], [1, 1, 1, 1, 104, 108, 108, 114, 114, 114, 114, 114, 114, 108, 108, 104, 1, 1, 1, 1], [1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 0, 108, 108, 108, 108, 0, 1, 1, 1], [1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1, 108, 108, 108, 108, 1, 1, 1, 1], [1, 1, 1, 1, 1, 109, 10000, 1, 1, 1, 1, 1, 1, 108, 108, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 113, 0, 0, 0, 106, 1, 105, 0, 0, 0, 103, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 113, 0, 1, 106, 1, 105, 1, 0, 103, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 113, 0, 106, 1, 105, 0, 103, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 1, 113, 106, 1, 105, 103, 1, 1, 1, 1, 0, 0, 0, 1], [1, 10000, 102, 102, 102, 102, 102, 102, 0, 1000, 0, 102, 102, 102, 102, 102, 102, 102, 0, 1], [1, 0, 0, 1, 1, 1, 1, 103, 105, 1, 106, 113, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 103, 0, 105, 1, 106, 0, 113, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 103, 0, 1, 105, 1, 106, 1, 0, 113, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 103, 0, 1, 1, 105, 1, 106, 1, 1, 0, 113, 1, 0, 0, 0, 1], [1, 0, 0, 103, 0, 0, 0, 0, 105, 0, 106, 0, 0, 0, 0, 113, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 0, 102, 102, 0, 1, 1, 1, 1, 1, 0, 102, 102, 0, 1, 1, 1, 1, 1], [1, 0, 102, 1, 1, 102, 1, 1, 102, 102, 0, 102, 1, 1, 102, 0, 102, 102, 0, 1], [1, 102, 1, 1, 1, 0, 102, 102, 0, 0, 102, 0, 1, 1, 0, 102, 0, 0, 102, 1], [1, 102, 1, 0, 102, 102, 102, 1, 0, 102, 1, 102, 1, 0, 102, 1, 102, 1, 0, 1000], [1, 10000, 1, 102, 1, 1, 102, 1, 102, 1, 1, 102, 1, 102, 1, 1, 102, 1, 1, 1], [1, 1, 1, 102, 1, 1, 102, 1, 102, 1, 1, 102, 1, 102, 1, 1, 102, 1, 1, 1], [1, 1, 1, 102, 1, 102, 0, 1, 102, 1, 1, 102, 1, 102, 1, 1, 102, 1, 1, 1], [1, 1, 1, 0, 102, 0, 1, 1, 102, 1, 102, 0, 1, 102, 1, 102, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 0, 102, 0, 1, 1, 0, 102, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 108, 108, 0, 10000, 0, 0, 109, 109, 0, 0, 0, 0, 105, 105, 0, 0, 0, 1], [1, 108, 1, 1, 108, 0, 0, 109, 1, 1, 109, 0, 0, 105, 1, 1, 105, 0, 0, 1], [1, 108, 1, 1, 108, 0, 0, 109, 1, 1, 109, 0, 0, 105, 1, 1, 105, 0, 0, 1], [1000, 0, 108, 108, 0, 0, 0, 0, 109, 109, 0, 0, 0, 0, 105, 105, 0, 0, 0, 1], [1, 1, 102, 102, 1, 1, 1, 1, 102, 102, 1, 1, 1, 1, 102, 102, 1, 1, 1, 1], [1, 1, 102, 102, 1, 1, 1, 1, 102, 102, 1, 1, 1, 1, 102, 102, 1, 1, 1, 1], [1, 0, 108, 108, 0, 0, 0, 0, 109, 109, 0, 0, 0, 0, 103, 103, 0, 0, 0, 1], [1, 108, 1, 1, 108, 0, 0, 109, 1, 1, 109, 0, 0, 103, 1, 1, 103, 0, 0, 1], [1, 108, 1, 1, 108, 0, 0, 109, 1, 1, 109, 0, 0, 103, 1, 1, 103, 0, 0, 1], [1, 0, 108, 108, 0, 0, 0, 0, 109, 109, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 10000, 0, 114, 0, 1, 104, 104, 1, 0, 107, 0, 107, 0, 107, 0, 1, 0, 0, 1], [1, 0, 114, 0, 114, 1, 104, 107, 1, 0, 0, 114, 0, 114, 0, 0, 1, 102, 106, 1], [1, 0, 0, 114, 0, 1, 104, 104, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 1], [1, 114, 0, 0, 0, 1, 114, 104, 104, 0, 107, 0, 0, 0, 107, 0, 1, 1, 1, 1], [1, 0, 114, 0, 0, 1, 1, 1, 1, 0, 0, 114, 0, 114, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 0, 114, 0, 114, 0, 114, 0, 1, 1, 1, 1, 114, 0, 0, 0, 1], [1, 0, 102, 0, 0, 0, 114, 0, 114, 0, 0, 107, 107, 107, 1, 114, 114, 0, 0, 1], [1, 106, 106, 1, 114, 0, 0, 114, 0, 0, 0, 0, 107, 107, 1, 114, 114, 114, 0, 1], [1000, 102, 102, 1, 0, 114, 0, 0, 114, 0, 0, 1, 107, 107, 1, 114, 114, 114, 114, 1], [1, 106, 106, 1, 114, 0, 114, 0, 0, 0, 107, 1, 107, 107, 1, 114, 114, 114, 114, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 115, 0, 0, 0, 0, 0, 0, 0, 115, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 115, 1, 111, 1, 117, 1, 111, 1, 115, 1, 1, 1, 1, 0, 1], [1, 0, 111, 111, 111, 115, 1, 111, 1, 117, 1, 111, 1, 115, 111, 111, 111, 111, 0, 1], [1, 0, 1, 1, 1, 115, 1, 111, 1, 117, 1, 111, 1, 115, 1, 1, 1, 1, 0, 1], [1, 0, 111, 111, 111, 115, 1, 111, 1, 117, 1, 111, 1, 115, 111, 111, 111, 111, 0, 1], [1, 10000, 1, 1, 1, 115, 1, 111, 1, 117, 1, 111, 1, 115, 1, 1, 1, 1, 0, 1], [1, 0, 111, 111, 111, 115, 1, 111, 1, 117, 1, 111, 1, 115, 111, 111, 111, 111, 0, 1], [1, 0, 1, 1, 1, 115, 1, 111, 1, 117, 1, 111, 1, 115, 1, 1, 1, 1, 0, 1], [1, 0, 111, 111, 111, 115, 1, 111, 1, 117, 1, 111, 1, 115, 111, 111, 111, 111, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1], [1, 0, 105, 1, 103, 0, 1, 107, 107, 107, 107, 107, 107, 1, 0, 103, 1, 105, 0, 1], [1, 0, 105, 1, 103, 0, 1, 102, 1, 104, 104, 1, 102, 1, 0, 103, 1, 105, 0, 1], [1, 0, 105, 1, 103, 0, 1, 114, 114, 1, 1, 114, 114, 1, 0, 103, 1, 105, 0, 1], [1, 10000, 1, 1, 1, 0, 108, 114, 114, 106, 106, 114, 114, 108, 0, 1, 1, 1, 0, 1000], [1, 0, 103, 1, 105, 0, 1, 114, 114, 1, 1, 114, 114, 1, 0, 105, 1, 103, 0, 1], [1, 0, 103, 1, 105, 0, 1, 102, 1, 104, 104, 1, 102, 1, 0, 105, 1, 103, 0, 1], [1, 0, 103, 1, 105, 0, 1, 107, 107, 107, 107, 107, 107, 1, 0, 105, 1, 103, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 102, 1, 1, 102, 102, 1, 102, 102, 1, 102, 102, 1, 1, 102, 1, 0, 1], [1, 0, 1, 102, 0, 1, 1, 102, 1, 102, 102, 1, 102, 1, 1, 0, 102, 1, 0, 1], [1, 0, 1, 117, 102, 0, 1, 102, 102, 1, 1, 102, 102, 1, 0, 102, 117, 1, 0, 1], [1, 0, 0, 1, 117, 102, 0, 102, 102, 1, 1, 102, 102, 0, 102, 117, 1, 0, 0, 1], [1, 0, 0, 0, 1, 117, 102, 0, 1, 102, 102, 1, 0, 102, 117, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 117, 102, 1, 102, 102, 1, 102, 117, 1, 0, 0, 0, 0, 1], [1, 0, 104, 0, 0, 0, 1, 111, 111, 111, 111, 111, 111, 1, 0, 0, 0, 104, 0, 1], [1, 0, 0, 104, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 104, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 1, 1, 1, 1, 108, 109, 1, 1, 1, 1, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 1, 105, 106, 107, 108, 109, 1, 0, 0, 1, 114, 115, 116, 117, 1], [1000, 100, 101, 102, 103, 1, 105, 106, 107, 108, 109, 1, 0, 0, 1, 114, 115, 116, 117, 1], [1, 10000, 101, 102, 103, 1, 1, 1, 1, 108, 109, 1, 0, 0, 1, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 104, 105, 106, 1, 108, 109, 1, 0, 0, 1, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 104, 105, 106, 1, 108, 109, 1, 0, 0, 1, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 1, 105, 106, 1, 108, 109, 1, 0, 0, 1, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 1, 1, 1, 1, 108, 109, 1, 1, 1, 1, 114, 115, 116, 117, 1], [1, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]]
2
+
3
+ PASSWORDS = ['GOLEM', 'KRONE', 'MYDLO', 'LEDEN', 'STROP', 'LILIE', 'RYBKA', 'KLAUN', 'BRAUN', 'WHITE', 'MOUSE', 'DREAM', 'IDEAL', 'ILUZE', 'SAINT', 'BELLS', 'TROJA', 'EMOCE', 'BASTL', 'ISLAM', 'JEANS', 'METAL', 'MIKRO', 'SENZA', 'GALAX', 'STONE', 'SLAVE', 'FORTE', 'LUCIE', 'NATUR', 'BIENE', 'KATZE', 'HYDRO', 'FAUNA', 'ULTRA', 'TODAY', 'HOROR', 'GAPPA', 'RETAL', 'CLOCK', 'HOMER', 'BUNNY', 'FOTON', 'QUACK', 'HAFIK', 'DIZZY', 'STARK', 'ZARAZ', 'DUKEN', 'STORY']
@@ -0,0 +1,123 @@
1
+ import os
2
+ import arcade
3
+ from arcade.types import LBWH
4
+ from .constants import TILE_SIZE, GRID_W, GRID_H, is_collectible, Tile
5
+
6
+
7
+ class Renderer:
8
+ def __init__(self, res_path: str, win_w: int, win_h: int, scale: int):
9
+ self._win_w = win_w
10
+ self._win_h = win_h
11
+ self._scale = scale
12
+ self._T = TILE_SIZE * scale
13
+ self._cache: dict[tuple, arcade.Texture] = {}
14
+
15
+ def sheet(name: str) -> arcade.SpriteSheet:
16
+ return arcade.SpriteSheet(os.path.join(res_path, 'img', name))
17
+
18
+ self._loko_sheet = sheet('loko.png')
19
+ self._loko_bum_sheet = sheet('loko-bum.png')
20
+ self._stena_sheet = sheet('stena.png')
21
+ self._vrata_sheet = sheet('vrata.png')
22
+ self._veci_sheet = sheet('veci-vagony.png')
23
+
24
+ try:
25
+ arcade.load_font(os.path.join(res_path, 'fonts', 'pixel.ttf'))
26
+ except Exception:
27
+ pass
28
+
29
+ # ------------------------------------------------------------------
30
+ # Texture cache
31
+ # ------------------------------------------------------------------
32
+
33
+ def _tex(self, sheet: arcade.SpriteSheet, col: int, row: int) -> arcade.Texture:
34
+ key = (id(sheet), col, row)
35
+ if key not in self._cache:
36
+ T = TILE_SIZE
37
+ self._cache[key] = sheet.get_texture(
38
+ LBWH(col * T, row * T, T, T))
39
+ return self._cache[key]
40
+
41
+ # ------------------------------------------------------------------
42
+ # Drawing helpers
43
+ # ------------------------------------------------------------------
44
+
45
+ def _draw_grid(self, sheet: arcade.SpriteSheet,
46
+ col: int, row: int,
47
+ src_col: int, src_row: int) -> None:
48
+ T = self._T
49
+ rect = LBWH(col * T, self._win_h - (row + 1) * T, T, T)
50
+ arcade.draw_texture_rect(self._tex(sheet, src_col, src_row),
51
+ rect, pixelated=True)
52
+
53
+ def _draw_px(self, sheet: arcade.SpriteSheet,
54
+ px: float, py: float,
55
+ src_col: int, src_row: int) -> None:
56
+ T = self._T
57
+ rect = LBWH(px, self._win_h - py - T, T, T)
58
+ arcade.draw_texture_rect(self._tex(sheet, src_col, src_row),
59
+ rect, pixelated=True)
60
+
61
+ # ------------------------------------------------------------------
62
+ # Main draw
63
+ # ------------------------------------------------------------------
64
+
65
+ def draw(self, state: 'GameState') -> None:
66
+ self._draw_map(state)
67
+ self._draw_wagons(state)
68
+ self._draw_loko(state)
69
+ self._draw_hud(state)
70
+
71
+ def _draw_map(self, state: 'GameState') -> None:
72
+ for j in range(GRID_H):
73
+ for i in range(GRID_W):
74
+ v = state.mapa[j][i]
75
+ if v == Tile.WALL:
76
+ self._draw_grid(self._stena_sheet, i, j, 1, 0)
77
+ elif v == Tile.EMPTY:
78
+ self._draw_grid(self._stena_sheet, i, j, 0, 0)
79
+ elif is_collectible(v):
80
+ self._draw_grid(self._veci_sheet, i, j, state.anim, v - 100)
81
+ elif v == Tile.DOOR:
82
+ self._draw_grid(self._vrata_sheet, i, j, state.door_anim, 0)
83
+ else:
84
+ self._draw_grid(self._stena_sheet, i, j, 0, 0)
85
+
86
+ def _draw_wagons(self, state: 'GameState') -> None:
87
+ train = state.train
88
+ T = self._T
89
+ for i in range(len(train.wagons) - 1, -1, -1):
90
+ w = train.wagons[i]
91
+ if i < len(train.prev_wagons):
92
+ pw = train.prev_wagons[i]
93
+ px = (pw.x + (w.x - pw.x) * state.sub_step) * T
94
+ py = (pw.y + (w.y - pw.y) * state.sub_step) * T
95
+ else:
96
+ px = w.x * T
97
+ py = w.y * T
98
+ self._draw_px(self._veci_sheet, px, py, w.direction + 3, w.cargo)
99
+
100
+ def _draw_loko(self, state: 'GameState') -> None:
101
+ train = state.train
102
+ T = self._T
103
+ px = (train.prev_x + (train.loko_x - train.prev_x) * state.sub_step) * T
104
+ py = (train.prev_y + (train.loko_y - train.prev_y) * state.sub_step) * T
105
+ if state.crash_anim >= 100:
106
+ self._draw_px(self._loko_sheet, px, py, state.anim, train.loko_dir)
107
+ else:
108
+ self._draw_px(self._loko_bum_sheet, px, py, state.crash_anim, 0)
109
+
110
+ def _draw_hud(self, state: 'GameState') -> None:
111
+ s = self._scale
112
+ if state.show_password:
113
+ arcade.Text(f'HESLO: {state.level_password}',
114
+ 33 * s, self._win_h - 17 * s,
115
+ arcade.color.WHITE, 8 * s).draw()
116
+ if state.auto_pilot:
117
+ arcade.Text('STLAC MEDZERNIK',
118
+ 33 * s, self._win_h - 29 * s,
119
+ arcade.color.YELLOW, 8 * s).draw()
120
+ elif state.input_buffer:
121
+ arcade.Text(state.input_buffer,
122
+ 33 * s, self._win_h - 29 * s,
123
+ arcade.color.WHITE, 8 * s).draw()
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,37 @@
1
+ from dataclasses import dataclass, field
2
+ from .constants import RIGHT, STOP
3
+
4
+
5
+ @dataclass
6
+ class Wagon:
7
+ x: int
8
+ y: int
9
+ direction: int
10
+ cargo: int
11
+
12
+
13
+ @dataclass
14
+ class Train:
15
+ loko_x: int
16
+ loko_y: int
17
+ loko_dir: int = RIGHT
18
+ direction: int = STOP
19
+ wagons: list[Wagon] = field(default_factory=list)
20
+
21
+ # previous positions for smooth interpolation
22
+ prev_x: int = 0
23
+ prev_y: int = 0
24
+ prev_wagons: list[Wagon] = field(default_factory=list)
25
+
26
+ def snapshot(self) -> None:
27
+ self.prev_x = self.loko_x
28
+ self.prev_y = self.loko_y
29
+ self.prev_wagons = [Wagon(w.x, w.y, w.direction, w.cargo) for w in self.wagons]
30
+
31
+ def collides_with_self(self, x: int, y: int) -> bool:
32
+ if self.wagons and x == self.wagons[0].x and y == self.wagons[0].y:
33
+ return True
34
+ for i in range(2, len(self.wagons) - 1):
35
+ if x == self.wagons[i].x and y == self.wagons[i].y:
36
+ return True
37
+ return False
@@ -0,0 +1,15 @@
1
+ import os
2
+ import arcade
3
+
4
+
5
+ def main() -> None:
6
+ res_path = os.path.join(os.path.dirname(__file__), 'res')
7
+ res_path = os.path.abspath(res_path)
8
+
9
+ from .game import Game
10
+ game = Game(res_path)
11
+ arcade.run()
12
+
13
+
14
+ if __name__ == '__main__':
15
+ main()
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: vlak
3
+ Version: 1.0.0
4
+ Summary: Train snake puzzle game
5
+ Author-email: Pavel Revak <pavelrevak@gmail.com>
6
+ License: MIT
7
+ Keywords: game,snake,train,puzzle,pygame
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: Topic :: Games/Entertainment :: Puzzle Games
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: arcade>=3.0
15
+
16
+ # vlak
17
+
18
+ Hra hadík s vlakom pre Linux/macOS postavená na Python + Arcade.
19
+
20
+ Port pôvodnej DOS hry od **Miroslav Němček (Panda381)**:
21
+ https://github.com/Panda381
22
+
23
+ ![Python](https://img.shields.io/badge/python-3.13%2B-blue)
24
+ [![PyPI](https://img.shields.io/pypi/v/vlak)](https://pypi.org/project/vlak/)
25
+
26
+ ## Inštalácia
27
+
28
+ ```bash
29
+ pip install vlak
30
+ ```
31
+
32
+ ## Spustenie
33
+
34
+ ```bash
35
+ vlak
36
+ ```
37
+
38
+ ## Ovládanie
39
+
40
+ | Kláves | Akcia |
41
+ |--------|-------|
42
+ | **Šípky** | Zmena smeru vlaku |
43
+ | **Medzerník / Enter** | Ďalšia scéna / potvrdenie hesla |
44
+ | **Escape** | Ukončenie hry |
45
+ | **Alt+1 – Alt+4** | Zmena veľkosti okna (1× – 4×) |
46
+
47
+ Heslo pre preskočenie na konkrétnu scénu zadaj písmenami a potvrď **Enter**.
48
+
49
+ ## Vývoj
50
+
51
+ ### Závislosti
52
+
53
+ - Python 3.13+
54
+ - [arcade](https://api.arcade.academy/) 3.x
55
+
56
+ ### Inštalácia zo zdrojov
57
+
58
+ ```bash
59
+ git clone https://github.com/cortexm/vlak
60
+ cd vlak
61
+ python -m venv .venv
62
+ .venv/bin/pip install -e .
63
+ .venv/bin/vlak
64
+ ```
@@ -0,0 +1,32 @@
1
+ .gitignore
2
+ README.en.md
3
+ README.md
4
+ pyproject.toml
5
+ run.py
6
+ .github/workflows/publish.yml
7
+ vlak/__init__.py
8
+ vlak/_version.py
9
+ vlak/audio.py
10
+ vlak/autopilot.py
11
+ vlak/constants.py
12
+ vlak/game.py
13
+ vlak/levels.py
14
+ vlak/renderer.py
15
+ vlak/train.py
16
+ vlak/vlak.py
17
+ vlak.egg-info/PKG-INFO
18
+ vlak.egg-info/SOURCES.txt
19
+ vlak.egg-info/dependency_links.txt
20
+ vlak.egg-info/entry_points.txt
21
+ vlak.egg-info/requires.txt
22
+ vlak.egg-info/top_level.txt
23
+ vlak/res/img/loko-bum.png
24
+ vlak/res/img/loko.png
25
+ vlak/res/img/stena.png
26
+ vlak/res/img/veci-vagony.png
27
+ vlak/res/img/vrata.png
28
+ vlak/res/sounds/bell.wav
29
+ vlak/res/sounds/crash.wav
30
+ vlak/res/sounds/horn.wav
31
+ vlak/res/sounds/loko.wav
32
+ vlak/res/sounds/vagon.wav
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ vlak = vlak.vlak:main
@@ -0,0 +1 @@
1
+ arcade>=3.0
@@ -0,0 +1 @@
1
+ vlak