@@ -65,6 +65,8 @@ export const useGameStore = create((set, get) => ({
65
65
counting : false ,
66
66
queueLength : 0 ,
67
67
lastMove : undefined ,
68
+ board : [ ] ,
69
+ forbidden : [ - 1 , - 1 ] ,
68
70
countingComplete : ( ) => {
69
71
if ( ! get ( ) . counting ) {
70
72
return false
@@ -121,20 +123,10 @@ export const useGameStore = create((set, get) => ({
121
123
let move = moves [ moves . length - 1 ]
122
124
return move . action === "end"
123
125
} ,
124
- setAgreeCounting : ( agree ) => {
125
- set ( produce ( state => {
126
- state . agreeCounting = agree
127
- } ) )
128
- } ,
129
- gameState : {
130
- board : [ ] ,
131
- forbidden : [ - 1 , - 1 ] ,
132
- } ,
133
126
addMove : ( move ) => {
134
127
set ( produce ( state => {
135
128
if ( move . action === "end" ) {
136
129
state . moves . push ( move )
137
- state . gameState . gameHasEnded = true
138
130
return
139
131
}
140
132
let moves = get ( ) . moves
@@ -153,13 +145,10 @@ export const useGameStore = create((set, get) => ({
153
145
}
154
146
let [ storedMove , updated , forbidden ] = createMoveData ( baseBoard , moves , move , counting , get ( ) . handicap )
155
147
state . moves . push ( storedMove )
156
- if ( move . action !== "agreeCounting" ) {
157
- state . agreeCounting = false
158
- }
159
148
state . lastMove = move . action === "pass" ? undefined : storedMove
160
149
state . baseBoard = updated
161
- state . gameState . board = rehydrate ( updated )
162
- state . gameState . forbidden = forbidden
150
+ state . board = rehydrate ( updated )
151
+ state . forbidden = forbidden
163
152
if ( move . action === "pass" && moves . length && moves [ moves . length - 1 ] . action === "pass" ) {
164
153
state . counting = true
165
154
}
@@ -190,7 +179,6 @@ export const useGameStore = create((set, get) => ({
190
179
for ( let move of game . moves ) {
191
180
if ( move . action === "end" ) {
192
181
moves . push ( move )
193
- state . gameState . gameHasEnded = true
194
182
break
195
183
}
196
184
if ( move . action === "pass" ) {
@@ -218,8 +206,8 @@ export const useGameStore = create((set, get) => ({
218
206
state . dim = game . dim
219
207
state . baseBoard = baseBoard
220
208
state . moves = moves
221
- state . gameState . board = rehydrate ( baseBoard )
222
- state . gameState . forbidden = forbidden
209
+ state . board = rehydrate ( baseBoard )
210
+ state . forbidden = forbidden
223
211
state . handicap = game . handicap
224
212
state . queueLength = queueLength
225
213
state . queueStatus = "up_to_date"
0 commit comments