@@ -21,14 +21,13 @@ class Sokoban final : public jaffarPlus::Game
21
21
22
22
Sokoban (std::unique_ptr<Emulator> emulator, const nlohmann::json &config)
23
23
: jaffarPlus::Game(std::move(emulator), config)
24
- {
25
- }
24
+ {}
26
25
27
26
private:
28
27
29
28
__INLINE__ void registerGameProperties () override
30
29
{
31
- _quickerBan = ((jaffarPlus::emulator::QuickerBan*)_emulator.get ())->getEmulator ();
30
+ _quickerBan = ((jaffarPlus::emulator::QuickerBan *)_emulator.get ())->getEmulator ();
32
31
33
32
registerGameProperty (" Can Move Up" , &_canMoveUp, Property::datatype_t ::dt_bool, Property::endianness_t ::little);
34
33
registerGameProperty (" Can Move Down" , &_canMoveDown, Property::datatype_t ::dt_bool, Property::endianness_t ::little);
@@ -65,47 +64,40 @@ class Sokoban final : public jaffarPlus::Game
65
64
_isDeadlock = _quickerBan->getIsDeadlock ();
66
65
}
67
66
68
- __INLINE__ void computeAdditionalHashing (MetroHash128 &hashEngine) const override
69
- {
70
- hashEngine.Update (_quickerBan->getState (), _quickerBan->getStateSize ());
71
- }
67
+ __INLINE__ void computeAdditionalHashing (MetroHash128 &hashEngine) const override { hashEngine.Update (_quickerBan->getState (), _quickerBan->getStateSize ()); }
72
68
73
69
// Updating derivative values after updating the internal state
74
70
__INLINE__ void stateUpdatePostHook () override
75
71
{
76
72
_remainingBoxes = _quickerBan->getGoalCount () - _quickerBan->getBoxesOnGoal ();
77
-
78
- // Getting pusher
73
+
74
+ // Getting pusher
79
75
80
76
// Checking if we can move up
81
77
_canMoveUp = _quickerBan->canMoveUp ();
82
78
if (_hasMovedBox == false )
83
79
if (*_pusherPosX == _pusherPrevPosX)
84
- if ((*_pusherPosY- 1 ) == _pusherPrevPosY) _canMoveUp = false ;
80
+ if ((*_pusherPosY - 1 ) == _pusherPrevPosY) _canMoveUp = false ;
85
81
86
82
_canMoveDown = _quickerBan->canMoveDown ();
87
83
if (_hasMovedBox == false )
88
84
if (*_pusherPosX == _pusherPrevPosX)
89
- if ((*_pusherPosY+ 1 ) == _pusherPrevPosY) _canMoveDown = false ;
85
+ if ((*_pusherPosY + 1 ) == _pusherPrevPosY) _canMoveDown = false ;
90
86
91
87
_canMoveLeft = _quickerBan->canMoveLeft ();
92
88
if (_hasMovedBox == false )
93
- if ((*_pusherPosX- 1 ) == _pusherPrevPosX)
89
+ if ((*_pusherPosX - 1 ) == _pusherPrevPosX)
94
90
if (*_pusherPosY == _pusherPrevPosY) _canMoveLeft = false ;
95
91
96
92
_canMoveRight = _quickerBan->canMoveRight ();
97
93
if (_hasMovedBox == false )
98
- if ((*_pusherPosX+ 1 ) == _pusherPrevPosX)
94
+ if ((*_pusherPosX + 1 ) == _pusherPrevPosX)
99
95
if (*_pusherPosY == _pusherPrevPosY) _canMoveRight = false ;
100
96
}
101
97
102
- __INLINE__ void ruleUpdatePreHook () override
103
- {
104
- }
98
+ __INLINE__ void ruleUpdatePreHook () override {}
105
99
106
- __INLINE__ void ruleUpdatePostHook () override
107
- {
108
- }
100
+ __INLINE__ void ruleUpdatePostHook () override {}
109
101
110
102
__INLINE__ void serializeStateImpl (jaffarCommon::serializer::Base &serializer) const override
111
103
{
@@ -157,20 +149,20 @@ class Sokoban final : public jaffarPlus::Game
157
149
return jaffarCommon::hash::hash_t ();
158
150
}
159
151
160
- uint8_t * _pusherPosX;
161
- uint8_t * _pusherPosY;
162
-
163
- bool _isDeadlock;
152
+ uint8_t * _pusherPosX;
153
+ uint8_t * _pusherPosY;
154
+
155
+ bool _isDeadlock;
164
156
uint8_t _pusherPrevPosX;
165
157
uint8_t _pusherPrevPosY;
166
- bool _hasMovedBox;
167
- bool _canMoveUp;
168
- bool _canMoveDown;
169
- bool _canMoveLeft;
170
- bool _canMoveRight;
171
-
172
- uint16_t _remainingBoxes;
173
- jaffar::EmuInstance* _quickerBan;
158
+ bool _hasMovedBox;
159
+ bool _canMoveUp;
160
+ bool _canMoveDown;
161
+ bool _canMoveLeft;
162
+ bool _canMoveRight;
163
+
164
+ uint16_t _remainingBoxes;
165
+ jaffar::EmuInstance * _quickerBan;
174
166
};
175
167
176
168
} // namespace sokoban
0 commit comments