Skip to content

Commit a367737

Browse files
Fixing tests
1 parent 1d54b31 commit a367737

File tree

10 files changed

+43
-49
lines changed

10 files changed

+43
-49
lines changed

emulators/quickerBan/quickerBan.hpp

+12-17
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,33 @@ class QuickerBan final : public Emulator
3232
// Function to get a reference to the input parser from the base emulator
3333
jaffar::InputParser *getInputParser() const override { return _quickerBan->getInputParser(); }
3434

35-
void initializeImpl() override
36-
{
37-
_quickerBan->initialize();
38-
}
35+
void initializeImpl() override { _quickerBan->initialize(); }
3936

40-
jaffar::EmuInstance* getEmulator() const { return _quickerBan.get(); }
37+
jaffar::EmuInstance *getEmulator() const { return _quickerBan.get(); }
4138

4239
// State advancing function
4340
void advanceStateImpl(const jaffar::input_t &input) override { _quickerBan->advanceState(input); }
4441

4542
__INLINE__ void serializeState(jaffarCommon::serializer::Base &serializer) const override { _quickerBan->serializeState(serializer); };
4643
__INLINE__ void deserializeState(jaffarCommon::deserializer::Base &deserializer) override { _quickerBan->deserializeState(deserializer); };
4744

48-
__INLINE__ void printInfo() const override { }
45+
__INLINE__ void printInfo() const override {}
4946

5047
property_t getProperty(const std::string &propertyName) const override
5148
{
5249
JAFFAR_THROW_LOGIC("Property name: '%s' not found in emulator '%s'", propertyName.c_str(), getName().c_str());
5350
}
5451

55-
void initializeVideoOutput() override {}
56-
void finalizeVideoOutput() override { }
57-
__INLINE__ void enableRendering() override { }
58-
__INLINE__ void disableRendering() override { }
59-
__INLINE__ void updateRendererState(const size_t stepIdx, const std::string input) override { }
60-
__INLINE__ void serializeRendererState(jaffarCommon::serializer::Base &serializer) const override { }
61-
__INLINE__ void deserializeRendererState(jaffarCommon::deserializer::Base &deserializer) override { }
62-
__INLINE__ size_t getRendererStateSize() const override { return 0; }
52+
void initializeVideoOutput() override {}
53+
void finalizeVideoOutput() override {}
54+
__INLINE__ void enableRendering() override {}
55+
__INLINE__ void disableRendering() override {}
56+
__INLINE__ void updateRendererState(const size_t stepIdx, const std::string input) override {}
57+
__INLINE__ void serializeRendererState(jaffarCommon::serializer::Base &serializer) const override {}
58+
__INLINE__ void deserializeRendererState(jaffarCommon::deserializer::Base &deserializer) override {}
59+
__INLINE__ size_t getRendererStateSize() const override { return 0; }
6360

64-
__INLINE__ void showRender() override
65-
{
66-
}
61+
__INLINE__ void showRender() override {}
6762

6863
private:
6964

examples/nes/sprilo/race01.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"Hash Step Tolerance": 0,
5555
"Show Empty Input Slots": false,
5656
"Show Allowed Inputs": false,
57+
"Bypass Hash Calculation": false,
5758

5859
"Store Input History":
5960
{

examples/nes/sprilo/race02.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"Hash Step Tolerance": 0,
5555
"Show Empty Input Slots": false,
5656
"Show Allowed Inputs": false,
57+
"Bypass Hash Calculation": false,
5758

5859
"Store Input History":
5960
{

examples/nes/sprilo/race03.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"Hash Step Tolerance": 0,
5555
"Show Empty Input Slots": false,
5656
"Show Allowed Inputs": false,
57+
"Bypass Hash Calculation": false,
5758

5859
"Store Input History":
5960
{

examples/nes/sprilo/race04.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"Hash Step Tolerance": 0,
5555
"Show Empty Input Slots": false,
5656
"Show Allowed Inputs": false,
57+
"Bypass Hash Calculation": false,
5758

5859
"Store Input History":
5960
{

examples/nes/superMarioBros/world101a.quickerNES.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"Hash Step Tolerance": 4,
5151
"Show Empty Input Slots": false,
5252
"Show Allowed Inputs": false,
53+
"Bypass Hash Calculation": false,
5354

5455
"Store Input History":
5556
{

examples/nes/superMarioBros/world101a.quickerSMBC.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"Hash Step Tolerance": 0,
4747
"Show Empty Input Slots": true,
4848
"Show Allowed Inputs": true,
49+
"Bypass Hash Calculation": false,
4950

5051
"Store Input History":
5152
{

games/sokoban/sokoban.hpp

+23-31
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ class Sokoban final : public jaffarPlus::Game
2121

2222
Sokoban(std::unique_ptr<Emulator> emulator, const nlohmann::json &config)
2323
: jaffarPlus::Game(std::move(emulator), config)
24-
{
25-
}
24+
{}
2625

2726
private:
2827

2928
__INLINE__ void registerGameProperties() override
3029
{
31-
_quickerBan = ((jaffarPlus::emulator::QuickerBan*)_emulator.get())->getEmulator();
30+
_quickerBan = ((jaffarPlus::emulator::QuickerBan *)_emulator.get())->getEmulator();
3231

3332
registerGameProperty("Can Move Up", &_canMoveUp, Property::datatype_t::dt_bool, Property::endianness_t::little);
3433
registerGameProperty("Can Move Down", &_canMoveDown, Property::datatype_t::dt_bool, Property::endianness_t::little);
@@ -65,47 +64,40 @@ class Sokoban final : public jaffarPlus::Game
6564
_isDeadlock = _quickerBan->getIsDeadlock();
6665
}
6766

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()); }
7268

7369
// Updating derivative values after updating the internal state
7470
__INLINE__ void stateUpdatePostHook() override
7571
{
7672
_remainingBoxes = _quickerBan->getGoalCount() - _quickerBan->getBoxesOnGoal();
77-
78-
// Getting pusher
73+
74+
// Getting pusher
7975

8076
// Checking if we can move up
8177
_canMoveUp = _quickerBan->canMoveUp();
8278
if (_hasMovedBox == false)
8379
if (*_pusherPosX == _pusherPrevPosX)
84-
if ((*_pusherPosY-1) == _pusherPrevPosY) _canMoveUp = false;
80+
if ((*_pusherPosY - 1) == _pusherPrevPosY) _canMoveUp = false;
8581

8682
_canMoveDown = _quickerBan->canMoveDown();
8783
if (_hasMovedBox == false)
8884
if (*_pusherPosX == _pusherPrevPosX)
89-
if ((*_pusherPosY+1) == _pusherPrevPosY) _canMoveDown = false;
85+
if ((*_pusherPosY + 1) == _pusherPrevPosY) _canMoveDown = false;
9086

9187
_canMoveLeft = _quickerBan->canMoveLeft();
9288
if (_hasMovedBox == false)
93-
if ((*_pusherPosX-1) == _pusherPrevPosX)
89+
if ((*_pusherPosX - 1) == _pusherPrevPosX)
9490
if (*_pusherPosY == _pusherPrevPosY) _canMoveLeft = false;
9591

9692
_canMoveRight = _quickerBan->canMoveRight();
9793
if (_hasMovedBox == false)
98-
if ((*_pusherPosX+1) == _pusherPrevPosX)
94+
if ((*_pusherPosX + 1) == _pusherPrevPosX)
9995
if (*_pusherPosY == _pusherPrevPosY) _canMoveRight = false;
10096
}
10197

102-
__INLINE__ void ruleUpdatePreHook() override
103-
{
104-
}
98+
__INLINE__ void ruleUpdatePreHook() override {}
10599

106-
__INLINE__ void ruleUpdatePostHook() override
107-
{
108-
}
100+
__INLINE__ void ruleUpdatePostHook() override {}
109101

110102
__INLINE__ void serializeStateImpl(jaffarCommon::serializer::Base &serializer) const override
111103
{
@@ -157,20 +149,20 @@ class Sokoban final : public jaffarPlus::Game
157149
return jaffarCommon::hash::hash_t();
158150
}
159151

160-
uint8_t* _pusherPosX;
161-
uint8_t* _pusherPosY;
162-
163-
bool _isDeadlock;
152+
uint8_t *_pusherPosX;
153+
uint8_t *_pusherPosY;
154+
155+
bool _isDeadlock;
164156
uint8_t _pusherPrevPosX;
165157
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;
174166
};
175167

176168
} // namespace sokoban

source/game.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class Game
477477
// Player-specific commands
478478
virtual void playerPrintCommands() const {}; // If the game has any specific player commands, print them now
479479
virtual void playerParseCommand(const int command){}; // If the game has any specific player commands, print them now
480-
480+
481481
// Function to get direct state hash without passing an hashing engine
482482
virtual jaffarCommon::hash::hash_t getDirectStateHash() const { return jaffarCommon::hash::hash_t(); };
483483

tests/nes/sprilo/race04_short.jaffar

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"Hash Step Tolerance": 0,
5151
"Show Empty Input Slots": false,
5252
"Show Allowed Inputs": false,
53+
"Bypass Hash Calculation": false,
5354

5455
"Store Input History":
5556
{

0 commit comments

Comments
 (0)