jp.ms.common.engine 1.0.3 → 1.0.5
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.
- package/dist/base/base-game-state.type.d.ts +8 -0
- package/dist/base/base-game-state.type.d.ts.map +1 -0
- package/dist/base/base-game-state.type.js +3 -0
- package/dist/base/base-game-state.type.js.map +1 -0
- package/dist/base/game-control-player-turn.d.ts +4 -4
- package/dist/base/game-control-player-turn.d.ts.map +1 -1
- package/dist/base/game-control-player-turn.js.map +1 -1
- package/dist/base/game-master.d.ts +27 -21
- package/dist/base/game-master.d.ts.map +1 -1
- package/dist/base/game-master.js +17 -2
- package/dist/base/game-master.js.map +1 -1
- package/dist/base/game-player-connections-helper.d.ts +22 -0
- package/dist/base/game-player-connections-helper.d.ts.map +1 -0
- package/dist/base/game-player-connections-helper.js +37 -0
- package/dist/base/game-player-connections-helper.js.map +1 -0
- package/dist/base/game-player.d.ts +4 -1
- package/dist/base/game-player.d.ts.map +1 -1
- package/dist/base/game-player.js +8 -1
- package/dist/base/game-player.js.map +1 -1
- package/dist/base/game-room.d.ts +15 -17
- package/dist/base/game-room.d.ts.map +1 -1
- package/dist/base/game-room.js +16 -17
- package/dist/base/game-room.js.map +1 -1
- package/dist/base/game-round.d.ts +8 -10
- package/dist/base/game-round.d.ts.map +1 -1
- package/dist/base/game-round.js +5 -4
- package/dist/base/game-round.js.map +1 -1
- package/dist/base/game-state-machine.d.ts +4 -4
- package/dist/base/game-state-machine.d.ts.map +1 -1
- package/dist/base/game-state-machine.js.map +1 -1
- package/dist/base/game-summary-result.d.ts +3 -0
- package/dist/base/game-summary-result.d.ts.map +1 -0
- package/dist/base/game-summary-result.js +7 -0
- package/dist/base/game-summary-result.js.map +1 -0
- package/dist/base/game-table-seat.d.ts +3 -3
- package/dist/base/game-table-seat.d.ts.map +1 -1
- package/dist/base/game-table-seat.js.map +1 -1
- package/dist/base/game-table-seats.d.ts +12 -12
- package/dist/base/game-table-seats.d.ts.map +1 -1
- package/dist/base/game-table-seats.js.map +1 -1
- package/dist/base/game-table.d.ts +26 -51
- package/dist/base/game-table.d.ts.map +1 -1
- package/dist/base/game-table.js +7 -0
- package/dist/base/game-table.js.map +1 -1
- package/dist/base/index.d.ts +3 -1
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.js +3 -1
- package/dist/base/index.js.map +1 -1
- package/dist/base/standard-game-state.d.ts +2 -2
- package/dist/base/standard-game-state.d.ts.map +1 -1
- package/dist/base/standard-game-state.js +1 -1
- package/dist/base/standard-game-state.js.map +1 -1
- package/dist/base-rooms/fast-tournament-room.d.ts +0 -13
- package/dist/base-rooms/fast-tournament-room.d.ts.map +1 -1
- package/dist/base-rooms/fast-tournament-room.js +59 -51
- package/dist/base-rooms/fast-tournament-room.js.map +1 -1
- package/dist/base-rooms/index.d.ts +1 -5
- package/dist/base-rooms/index.d.ts.map +1 -1
- package/dist/base-rooms/index.js +3 -9
- package/dist/base-rooms/index.js.map +1 -1
- package/dist/base-rooms/scheduled-tournament-room.d.ts +0 -27
- package/dist/base-rooms/scheduled-tournament-room.d.ts.map +1 -1
- package/dist/base-rooms/scheduled-tournament-room.js +181 -164
- package/dist/base-rooms/scheduled-tournament-room.js.map +1 -1
- package/dist/base-rooms/simple-room.d.ts +5 -4
- package/dist/base-rooms/simple-room.d.ts.map +1 -1
- package/dist/base-rooms/simple-room.js +16 -0
- package/dist/base-rooms/simple-room.js.map +1 -1
- package/dist/base-rooms/tournament-room.d.ts +0 -46
- package/dist/base-rooms/tournament-room.d.ts.map +1 -1
- package/dist/base-rooms/tournament-room.js +169 -109
- package/dist/base-rooms/tournament-room.js.map +1 -1
- package/dist/base-rooms/tournament-state.d.ts +2 -2
- package/dist/base-rooms/tournament-state.d.ts.map +1 -1
- package/dist/base-rooms/tournament-state.js +2 -2
- package/dist/base-rooms/tournament-state.js.map +1 -1
- package/dist/board-game/base/board-cell.d.ts +0 -15
- package/dist/board-game/base/board-cell.d.ts.map +1 -1
- package/dist/board-game/base/board-cell.js +50 -40
- package/dist/board-game/base/board-cell.js.map +1 -1
- package/dist/board-game/base/board-figure.d.ts +0 -15
- package/dist/board-game/base/board-figure.d.ts.map +1 -1
- package/dist/board-game/base/board-figure.js +49 -36
- package/dist/board-game/base/board-figure.js.map +1 -1
- package/dist/board-game/base/board-game-master.d.ts +0 -18
- package/dist/board-game/base/board-game-master.d.ts.map +1 -1
- package/dist/board-game/base/board-game-master.js +56 -34
- package/dist/board-game/base/board-game-master.js.map +1 -1
- package/dist/board-game/base/board-player-move.d.ts +0 -10
- package/dist/board-game/base/board-player-move.d.ts.map +1 -1
- package/dist/board-game/base/board-player-move.js +29 -28
- package/dist/board-game/base/board-player-move.js.map +1 -1
- package/dist/board-game/base/board-player.d.ts +0 -12
- package/dist/board-game/base/board-player.d.ts.map +1 -1
- package/dist/board-game/base/board-player.js +43 -29
- package/dist/board-game/base/board-player.js.map +1 -1
- package/dist/board-game/base/board-table.d.ts +0 -16
- package/dist/board-game/base/board-table.d.ts.map +1 -1
- package/dist/board-game/base/board-table.js +52 -33
- package/dist/board-game/base/board-table.js.map +1 -1
- package/dist/board-game/d1-board-game/d1-board-table.d.ts +0 -18
- package/dist/board-game/d1-board-game/d1-board-table.d.ts.map +1 -1
- package/dist/board-game/d1-board-game/d1-board-table.js +56 -39
- package/dist/board-game/d1-board-game/d1-board-table.js.map +1 -1
- package/dist/board-game/d2-board-game/d2-board-cell.d.ts +0 -11
- package/dist/board-game/d2-board-game/d2-board-cell.d.ts.map +1 -1
- package/dist/board-game/d2-board-game/d2-board-cell.js +30 -24
- package/dist/board-game/d2-board-game/d2-board-cell.js.map +1 -1
- package/dist/board-game/d2-board-game/d2-board-pattern-move-figure.d.ts +0 -28
- package/dist/board-game/d2-board-game/d2-board-pattern-move-figure.d.ts.map +1 -1
- package/dist/board-game/d2-board-game/d2-board-pattern-move-figure.js +79 -49
- package/dist/board-game/d2-board-game/d2-board-pattern-move-figure.js.map +1 -1
- package/dist/board-game/d2-board-game/d2-board-table.d.ts +0 -48
- package/dist/board-game/d2-board-game/d2-board-table.d.ts.map +1 -1
- package/dist/board-game/d2-board-game/d2-board-table.js +262 -182
- package/dist/board-game/d2-board-game/d2-board-table.js.map +1 -1
- package/dist/board-game/d2-board-game/types.d.ts +0 -4
- package/dist/board-game/d2-board-game/types.d.ts.map +1 -1
- package/dist/board-game/d2-board-game/types.js +4 -1
- package/dist/board-game/d2-board-game/types.js.map +1 -1
- package/dist/board-game/dice.js +2 -2
- package/dist/board-game/dice.js.map +1 -1
- package/dist/board-game/index.d.ts +0 -12
- package/dist/board-game/index.d.ts.map +1 -1
- package/dist/board-game/index.js +28 -24
- package/dist/board-game/index.js.map +1 -1
- package/dist/cards-game/cards-game-master.d.ts +7 -8
- package/dist/cards-game/cards-game-master.d.ts.map +1 -1
- package/dist/cards-game/cards-game-master.js +14 -10
- package/dist/cards-game/cards-game-master.js.map +1 -1
- package/dist/cards-game/cards-player.d.ts.map +1 -1
- package/dist/cards-game/cards-player.js +1 -1
- package/dist/cards-game/cards-player.js.map +1 -1
- package/dist/cards-game/index.d.ts +1 -2
- package/dist/cards-game/index.d.ts.map +1 -1
- package/dist/cards-game/index.js +1 -3
- package/dist/cards-game/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tests/just-black-jack/domain/black-jack-dealer.d.ts +6 -0
- package/dist/tests/just-black-jack/domain/black-jack-dealer.d.ts.map +1 -0
- package/dist/tests/just-black-jack/domain/black-jack-dealer.js +14 -0
- package/dist/tests/just-black-jack/domain/black-jack-dealer.js.map +1 -0
- package/dist/tests/just-black-jack/domain/black-jack-game-master.d.ts +28 -0
- package/dist/tests/just-black-jack/domain/black-jack-game-master.d.ts.map +1 -0
- package/dist/tests/just-black-jack/domain/black-jack-game-master.js +89 -0
- package/dist/tests/just-black-jack/domain/black-jack-game-master.js.map +1 -0
- package/dist/tests/just-black-jack/domain/black-jack-player.d.ts +9 -0
- package/dist/tests/just-black-jack/domain/black-jack-player.d.ts.map +1 -0
- package/dist/tests/just-black-jack/domain/black-jack-player.js +21 -0
- package/dist/tests/just-black-jack/domain/black-jack-player.js.map +1 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.d.ts +3 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.d.ts.map +1 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.js +30 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.js.map +1 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.test.d.ts +2 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.test.d.ts.map +1 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.test.js +34 -0
- package/dist/tests/just-black-jack/helpers/calculate-result.test.js.map +1 -0
- package/dist/tests/just-black-jack/rooms/black-jack-simple-room.d.ts +6 -0
- package/dist/tests/just-black-jack/rooms/black-jack-simple-room.d.ts.map +1 -0
- package/dist/tests/just-black-jack/rooms/black-jack-simple-room.js +13 -0
- package/dist/tests/just-black-jack/rooms/black-jack-simple-room.js.map +1 -0
- package/dist/tests/just-black-jack/tests/black-jack-simple-room.test.d.ts +2 -0
- package/dist/tests/just-black-jack/tests/black-jack-simple-room.test.d.ts.map +1 -0
- package/dist/tests/just-black-jack/tests/black-jack-simple-room.test.js +58 -0
- package/dist/tests/just-black-jack/tests/black-jack-simple-room.test.js.map +1 -0
- package/dist/tests/just-black-jack/tests/common.d.ts +11 -0
- package/dist/tests/just-black-jack/tests/common.d.ts.map +1 -0
- package/dist/tests/just-black-jack/tests/common.js +51 -0
- package/dist/tests/just-black-jack/tests/common.js.map +1 -0
- package/package.json +2 -1
- package/src/base/base-game-state.type.ts +7 -0
- package/src/base/game-control-player-turn.ts +5 -5
- package/src/base/game-master.ts +38 -19
- package/src/base/game-player-connections-helper.ts +45 -0
- package/src/base/game-player.ts +11 -2
- package/src/base/game-room.ts +26 -30
- package/src/base/game-round.ts +13 -15
- package/src/base/game-state-machine.ts +7 -7
- package/src/base/game-summary-result.ts +3 -0
- package/src/base/game-table-seat.ts +3 -3
- package/src/base/game-table-seats.ts +13 -13
- package/src/base/game-table.ts +36 -79
- package/src/base/index.ts +4 -0
- package/src/base/standard-game-state.ts +2 -2
- package/src/base-rooms/fast-tournament-room.ts +59 -59
- package/src/base-rooms/index.ts +9 -9
- package/src/base-rooms/scheduled-tournament-room.ts +181 -181
- package/src/base-rooms/simple-room.ts +15 -4
- package/src/base-rooms/tournament-room.ts +169 -169
- package/src/base-rooms/tournament-state.ts +2 -2
- package/src/board-game/base/board-cell.ts +50 -50
- package/src/board-game/base/board-figure.ts +49 -49
- package/src/board-game/base/board-game-master.ts +56 -56
- package/src/board-game/base/board-player-move.ts +29 -29
- package/src/board-game/base/board-player.ts +43 -43
- package/src/board-game/base/board-table.ts +52 -52
- package/src/board-game/d1-board-game/d1-board-table.ts +56 -56
- package/src/board-game/d2-board-game/d2-board-cell.ts +30 -30
- package/src/board-game/d2-board-game/d2-board-pattern-move-figure.ts +79 -79
- package/src/board-game/d2-board-game/d2-board-table.ts +262 -262
- package/src/board-game/d2-board-game/types.ts +4 -4
- package/src/board-game/dice.ts +1 -1
- package/src/board-game/index.ts +28 -28
- package/src/cards-game/cards-game-master.ts +20 -16
- package/src/cards-game/cards-player.ts +2 -1
- package/src/cards-game/index.ts +0 -2
- package/src/index.ts +1 -1
- package/src/tests/just-black-jack/domain/black-jack-dealer.ts +15 -0
- package/src/tests/just-black-jack/domain/black-jack-game-master.ts +102 -0
- package/src/tests/just-black-jack/domain/black-jack-player.ts +27 -0
- package/src/tests/just-black-jack/helpers/calculate-result.test.ts +49 -0
- package/src/tests/just-black-jack/helpers/calculate-result.ts +34 -0
- package/src/tests/just-black-jack/rooms/black-jack-simple-room.ts +10 -0
- package/src/tests/just-black-jack/tests/black-jack-simple-room.test.ts +75 -0
- package/src/tests/just-black-jack/tests/common.ts +63 -0
- package/dist/cards-game/cards-table.d.ts +0 -11
- package/dist/cards-game/cards-table.d.ts.map +0 -1
- package/dist/cards-game/cards-table.js +0 -20
- package/dist/cards-game/cards-table.js.map +0 -1
- package/src/cards-game/cards-table.ts +0 -28
|
@@ -1,262 +1,262 @@
|
|
|
1
|
-
import { flatten, last, take, uniqBy } from 'lodash';
|
|
2
|
-
|
|
3
|
-
import { GamePlayer } from '../../base';
|
|
4
|
-
import { GameTableConfig } from '../../base/game-table';
|
|
5
|
-
import { BoardFigure } from '../base/board-figure';
|
|
6
|
-
import { BoardTable } from '../base/board-table';
|
|
7
|
-
|
|
8
|
-
import { D2BoardCell } from './d2-board-cell';
|
|
9
|
-
import { Coordinate } from './types';
|
|
10
|
-
|
|
11
|
-
export interface ID2BoardTable<BF extends BoardFigure> {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export abstract class D2BoardTable<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
> extends BoardTable<GP, GM, GSR, BF, D2BoardCell<BF>> implements ID2BoardTable<BF> {
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
1
|
+
// import { flatten, last, take, uniqBy } from 'lodash';
|
|
2
|
+
//
|
|
3
|
+
// import { GamePlayer } from '../../base';
|
|
4
|
+
// import { GameTableConfig } from '../../base/game-table';
|
|
5
|
+
// import { BoardFigure } from '../base/board-figure';
|
|
6
|
+
// import { BoardTable } from '../base/board-table';
|
|
7
|
+
//
|
|
8
|
+
// import { D2BoardCell } from './d2-board-cell';
|
|
9
|
+
// import { Coordinate } from './types';
|
|
10
|
+
//
|
|
11
|
+
// export interface ID2BoardTable<BF extends BoardFigure> {
|
|
12
|
+
// getUpLeftDiagonal (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
13
|
+
//
|
|
14
|
+
// getUpRightDiagonal (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
15
|
+
//
|
|
16
|
+
// getDownLeftDiagonal (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
17
|
+
//
|
|
18
|
+
// getDownRightDiagonal (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
19
|
+
//
|
|
20
|
+
// getUpVertical (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
21
|
+
//
|
|
22
|
+
// getDownVertical (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
23
|
+
//
|
|
24
|
+
// getLeftHorizontal (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
25
|
+
//
|
|
26
|
+
// getRightHorizontal (center: Coordinate): Array<D2BoardCell<BF>>;
|
|
27
|
+
// }
|
|
28
|
+
//
|
|
29
|
+
// export abstract class D2BoardTable<
|
|
30
|
+
// GP extends GamePlayer,
|
|
31
|
+
// GM,
|
|
32
|
+
// GSR,
|
|
33
|
+
// BF extends BoardFigure,
|
|
34
|
+
// > extends BoardTable<GP, GM, GSR, BF, D2BoardCell<BF>> implements ID2BoardTable<BF> {
|
|
35
|
+
// cells: Array<Array<D2BoardCell<BF>>>;
|
|
36
|
+
// readonly height: number;
|
|
37
|
+
// readonly width: number;
|
|
38
|
+
//
|
|
39
|
+
// protected constructor (config: GameTableConfig<GP>, height: number, width: number) {
|
|
40
|
+
// super(config);
|
|
41
|
+
// this.height = height;
|
|
42
|
+
// this.width = width;
|
|
43
|
+
// this.initCells();
|
|
44
|
+
// }
|
|
45
|
+
//
|
|
46
|
+
// initCells () {
|
|
47
|
+
// const cells: Array<Array<D2BoardCell<BF>>> = [];
|
|
48
|
+
// let id = 0;
|
|
49
|
+
// for (let i = 0; i < this.getHeight(); i += 1) {
|
|
50
|
+
// cells.push([]);
|
|
51
|
+
// for (let j = 0; j < this.getWidth(); j += 1) {
|
|
52
|
+
// cells[i].push(new D2BoardCell(id, j, i));
|
|
53
|
+
// id += 1;
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
// this.cells = cells;
|
|
58
|
+
// }
|
|
59
|
+
//
|
|
60
|
+
// getHeight () {
|
|
61
|
+
// return this.height;
|
|
62
|
+
// }
|
|
63
|
+
//
|
|
64
|
+
// getWidth () {
|
|
65
|
+
// return this.width;
|
|
66
|
+
// }
|
|
67
|
+
//
|
|
68
|
+
// getCell (id: number): D2BoardCell<BF> | null {
|
|
69
|
+
// return this.getCellsArray().find((item) => item.getId() === id) ?? null;
|
|
70
|
+
// }
|
|
71
|
+
//
|
|
72
|
+
// getCellByCoordinate (y: number, x: number): D2BoardCell<BF> | null {
|
|
73
|
+
// return this.cells[y]?.[x] ?? null;
|
|
74
|
+
// }
|
|
75
|
+
//
|
|
76
|
+
// getCells (): Array<Array<D2BoardCell<BF>>> {
|
|
77
|
+
// return this.cells;
|
|
78
|
+
// }
|
|
79
|
+
//
|
|
80
|
+
// getCellsArray (): Array<D2BoardCell<BF>> {
|
|
81
|
+
// return flatten(this.cells);
|
|
82
|
+
// }
|
|
83
|
+
//
|
|
84
|
+
// getUpLeftDiagonal (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
85
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
86
|
+
//
|
|
87
|
+
// for (let row = center.y, col = center.x; row >= 0 && col >= 0; row -= 1, col -= 1) {
|
|
88
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
89
|
+
// if (foundCell) {
|
|
90
|
+
// cells.push(foundCell);
|
|
91
|
+
// }
|
|
92
|
+
// }
|
|
93
|
+
//
|
|
94
|
+
// return cells;
|
|
95
|
+
// }
|
|
96
|
+
//
|
|
97
|
+
// getUpRightDiagonal (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
98
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
99
|
+
//
|
|
100
|
+
// for (let row = center.y, col = center.x; row >= 0 && col < this.cells.length; row -= 1, col += 1) {
|
|
101
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
102
|
+
// if (foundCell) {
|
|
103
|
+
// cells.push(foundCell);
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
//
|
|
107
|
+
// return cells;
|
|
108
|
+
// }
|
|
109
|
+
//
|
|
110
|
+
// getDownLeftDiagonal (center: Coordinate) {
|
|
111
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
112
|
+
//
|
|
113
|
+
// for (let row = center.y, col = center.x; row < 8 && col >= 0; row += 1, col -= 1) {
|
|
114
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
115
|
+
// if (foundCell) {
|
|
116
|
+
// cells.push(foundCell);
|
|
117
|
+
// }
|
|
118
|
+
// }
|
|
119
|
+
//
|
|
120
|
+
// return cells;
|
|
121
|
+
// }
|
|
122
|
+
//
|
|
123
|
+
// getDownRightDiagonal (center: Coordinate) {
|
|
124
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
125
|
+
//
|
|
126
|
+
// for (let row = center.y, col = center.x; row < 8 && col < this.cells.length; row += 1, col += 1) {
|
|
127
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
128
|
+
// if (foundCell) {
|
|
129
|
+
// cells.push(foundCell);
|
|
130
|
+
// }
|
|
131
|
+
// }
|
|
132
|
+
//
|
|
133
|
+
// return cells;
|
|
134
|
+
// }
|
|
135
|
+
//
|
|
136
|
+
// getUpVertical (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
137
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
138
|
+
//
|
|
139
|
+
// for (let row = center.y, col = center.x; row >= 0; row -= 1) {
|
|
140
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
141
|
+
// if (foundCell) {
|
|
142
|
+
// cells.push(foundCell);
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
145
|
+
//
|
|
146
|
+
// return cells;
|
|
147
|
+
// }
|
|
148
|
+
//
|
|
149
|
+
// getDownVertical (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
150
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
151
|
+
//
|
|
152
|
+
// for (let row = center.y, col = center.x; row < this.cells.length; row += 1) {
|
|
153
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
154
|
+
// if (foundCell) {
|
|
155
|
+
// cells.push(foundCell);
|
|
156
|
+
// }
|
|
157
|
+
// }
|
|
158
|
+
//
|
|
159
|
+
// return cells;
|
|
160
|
+
// }
|
|
161
|
+
//
|
|
162
|
+
// getLeftHorizontal (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
163
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
164
|
+
//
|
|
165
|
+
// for (let row = center.y, col = center.x; col >= 0; col -= 1) {
|
|
166
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
167
|
+
// if (foundCell) {
|
|
168
|
+
// cells.push(foundCell);
|
|
169
|
+
// }
|
|
170
|
+
// }
|
|
171
|
+
//
|
|
172
|
+
// return cells;
|
|
173
|
+
// }
|
|
174
|
+
//
|
|
175
|
+
// getRightHorizontal (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
176
|
+
// const cells: Array<D2BoardCell<BF>> = [];
|
|
177
|
+
//
|
|
178
|
+
// for (let row = center.y, col = center.x; col < this.cells.length; col += 1) {
|
|
179
|
+
// const foundCell = this.getCellByCoordinate(row, col);
|
|
180
|
+
// if (foundCell) {
|
|
181
|
+
// cells.push(foundCell);
|
|
182
|
+
// }
|
|
183
|
+
// }
|
|
184
|
+
//
|
|
185
|
+
// return cells;
|
|
186
|
+
// }
|
|
187
|
+
//
|
|
188
|
+
// getEdgedCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
189
|
+
// const length = 3;
|
|
190
|
+
// const shift = 2;
|
|
191
|
+
//
|
|
192
|
+
// const first: Coordinate = { x: center.x - 1, y: center.y - 1 };
|
|
193
|
+
// const second: Coordinate = { x: first.x + shift, y: first.y };
|
|
194
|
+
// const third: Coordinate = { x: second.x, y: second.y + shift };
|
|
195
|
+
// const fourth: Coordinate = { x: second.x - shift, y: second.y };
|
|
196
|
+
//
|
|
197
|
+
// const list = [
|
|
198
|
+
// take(this.getRightHorizontal(first), length),
|
|
199
|
+
// take(this.getDownVertical(second), length),
|
|
200
|
+
// take(this.getLeftHorizontal(third), length),
|
|
201
|
+
// take(this.getUpVertical(fourth), length),
|
|
202
|
+
// ];
|
|
203
|
+
//
|
|
204
|
+
// return uniqBy(flatten(list), (item) => item.getId());
|
|
205
|
+
// }
|
|
206
|
+
//
|
|
207
|
+
// getEdgedRectangleCells (list: Array<Coordinate>): Array<D2BoardCell<BF>> {
|
|
208
|
+
// let cells: Array<Array<D2BoardCell<BF>>> = [];
|
|
209
|
+
//
|
|
210
|
+
// list.forEach((center) => {
|
|
211
|
+
// cells.push(this.getEdgedCells(center));
|
|
212
|
+
// });
|
|
213
|
+
//
|
|
214
|
+
// return uniqBy(flatten(cells), (item) => item.getId());
|
|
215
|
+
// }
|
|
216
|
+
//
|
|
217
|
+
// getPistolUpVerticalLeftCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
218
|
+
// return this.getPistolCells(this.getUpVertical(center), this.getLeftHorizontal);
|
|
219
|
+
// }
|
|
220
|
+
//
|
|
221
|
+
// getPistolUpVerticalRightCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
222
|
+
// return this.getPistolCells(this.getUpVertical(center), this.getRightHorizontal);
|
|
223
|
+
// }
|
|
224
|
+
//
|
|
225
|
+
// getPistolDownVerticalLeftCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
226
|
+
// return this.getPistolCells(this.getDownVertical(center), this.getLeftHorizontal);
|
|
227
|
+
// }
|
|
228
|
+
//
|
|
229
|
+
// getPistolDownVerticalRightCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
230
|
+
// return this.getPistolCells(this.getDownVertical(center), this.getRightHorizontal);
|
|
231
|
+
// }
|
|
232
|
+
//
|
|
233
|
+
// getPistolLeftHorizontalUpCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
234
|
+
// return this.getPistolCells(this.getLeftHorizontal(center), this.getUpVertical);
|
|
235
|
+
// }
|
|
236
|
+
//
|
|
237
|
+
// getPistolLeftHorizontalDownCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
238
|
+
// return this.getPistolCells(this.getLeftHorizontal(center), this.getDownVertical);
|
|
239
|
+
// }
|
|
240
|
+
//
|
|
241
|
+
// getPistolRightHorizontalUpCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
242
|
+
// return this.getPistolCells(this.getRightHorizontal(center), this.getUpVertical);
|
|
243
|
+
// }
|
|
244
|
+
//
|
|
245
|
+
// getPistolRightHorizontalDownCells (center: Coordinate): Array<D2BoardCell<BF>> {
|
|
246
|
+
// return this.getPistolCells(this.getRightHorizontal(center), this.getDownVertical);
|
|
247
|
+
// }
|
|
248
|
+
//
|
|
249
|
+
// private getPistolCells (directPath: Array<D2BoardCell<BF>>, sidePath: (center: Coordinate) => Array<D2BoardCell<BF>>): Array<D2BoardCell<BF>> {
|
|
250
|
+
// const KNIGHT_UP_MOVE = 3;
|
|
251
|
+
// const KNIGHT_SIDE_MOVE = 2;
|
|
252
|
+
//
|
|
253
|
+
// const lastDirectCell = last(take(directPath, KNIGHT_UP_MOVE));
|
|
254
|
+
// if (lastDirectCell) {
|
|
255
|
+
// const sideCells = take(sidePath(lastDirectCell.getCoordinate()), KNIGHT_SIDE_MOVE);
|
|
256
|
+
//
|
|
257
|
+
// return uniqBy([...directPath, ...sideCells], (item) => item.getId());
|
|
258
|
+
// }
|
|
259
|
+
//
|
|
260
|
+
// return [];
|
|
261
|
+
// }
|
|
262
|
+
// }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Coordinate = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
// export type Coordinate = {
|
|
2
|
+
// x: number;
|
|
3
|
+
// y: number;
|
|
4
|
+
// }
|
package/src/board-game/dice.ts
CHANGED
package/src/board-game/index.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { BoardCell } from './base/board-cell';
|
|
2
|
-
import { BoardFigure } from './base/board-figure';
|
|
3
|
-
import { BoardGameMaster } from './base/board-game-master';
|
|
4
|
-
import { BoardPlayer } from './base/board-player';
|
|
5
|
-
import { BoardPlayerMove } from './base/board-player-move';
|
|
6
|
-
import { BoardTable } from './base/board-table';
|
|
7
|
-
import { D1BoardTable } from './d1-board-game/d1-board-table';
|
|
8
|
-
import { D2BoardCell } from './d2-board-game/d2-board-cell';
|
|
9
|
-
import { D2BoardPatternMoveFigure } from './d2-board-game/d2-board-pattern-move-figure';
|
|
10
|
-
import { D2BoardTable } from './d2-board-game/d2-board-table';
|
|
11
|
-
import { Dice } from './dice';
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
// import { BoardCell } from './base/board-cell';
|
|
2
|
+
// import { BoardFigure } from './base/board-figure';
|
|
3
|
+
// import { BoardGameMaster } from './base/board-game-master';
|
|
4
|
+
// import { BoardPlayer } from './base/board-player';
|
|
5
|
+
// import { BoardPlayerMove } from './base/board-player-move';
|
|
6
|
+
// import { BoardTable } from './base/board-table';
|
|
7
|
+
// import { D1BoardTable } from './d1-board-game/d1-board-table';
|
|
8
|
+
// import { D2BoardCell } from './d2-board-game/d2-board-cell';
|
|
9
|
+
// import { D2BoardPatternMoveFigure } from './d2-board-game/d2-board-pattern-move-figure';
|
|
10
|
+
// import { D2BoardTable } from './d2-board-game/d2-board-table';
|
|
11
|
+
// import { Dice } from './dice';
|
|
12
|
+
//
|
|
13
|
+
// export {
|
|
14
|
+
// BoardCell,
|
|
15
|
+
// BoardFigure,
|
|
16
|
+
// BoardGameMaster,
|
|
17
|
+
// BoardPlayer,
|
|
18
|
+
// BoardPlayerMove,
|
|
19
|
+
// BoardTable,
|
|
20
|
+
// D1BoardTable,
|
|
21
|
+
// D2BoardCell,
|
|
22
|
+
// D2BoardPatternMoveFigure,
|
|
23
|
+
// D2BoardTable,
|
|
24
|
+
// Dice,
|
|
25
|
+
// }
|
|
26
|
+
//
|
|
27
|
+
//
|
|
28
|
+
//
|