Skip to content

Commit

Permalink
Correct some typo in code and clean unused parameters. Update VS2015 …
Browse files Browse the repository at this point in the history
…Project.
  • Loading branch information
Jean-Sébastien Gonsette committed May 16, 2019
1 parent a590503 commit 0b48d6c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
*.lo
*.o
*.obj
*.pdb
*.ipdb
*.iobj
*.exp

# Precompiled Headers
*.gch
Expand All @@ -14,7 +18,7 @@
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# *.dll

# Fortran module files
*.mod
Expand All @@ -27,6 +31,6 @@
*.lib

# Executables
*.exe
# *.exe
*.out
*.app
3 changes: 0 additions & 3 deletions Projects/VS2015/libWizium.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\Sources\Dictionary\Dictionary.cpp" />
<ClCompile Include="..\..\Sources\Engine.cpp" />
<ClCompile Include="..\..\Sources\Grid\Box.cpp" />
<ClCompile Include="..\..\Sources\Grid\Grid.cpp" />
<ClCompile Include="..\..\Sources\library.cpp" />
Expand All @@ -165,7 +164,6 @@
<ClCompile Include="..\..\Sources\Solvers\SolverDynamic.DynamicItem.cpp" />
<ClCompile Include="..\..\Sources\Solvers\SolverStatic.cpp" />
<ClCompile Include="..\..\Sources\Solvers\SolverStatic.StaticItem.cpp" />
<ClCompile Include="..\..\Sources\Solvers\SolverStatic2.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Sources\Dictionary\Dictionary.h" />
Expand All @@ -179,7 +177,6 @@
<ClInclude Include="..\..\Sources\Solvers\SolverDynamic.h" />
<ClInclude Include="..\..\Sources\Solvers\SolverStatic.h" />
<ClInclude Include="..\..\Sources\Solvers\SolverStatic.StaticItem.h" />
<ClInclude Include="..\..\Sources\Solvers\SolverStatic2.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
4 changes: 2 additions & 2 deletions Sources/Solvers/ISolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ISolver
virtual Status Solve_Step (int32_t maxTimeMs, int32_t maxSteps) = 0;
virtual void Solve_Stop () = 0;

virtual void SetHeurestic (bool state, int param) {};
virtual void SetHeurestic (bool state, int param) = 0;
virtual void SetSeed (uint64_t seed) {this->seed = seed;}

protected:
Expand All @@ -53,8 +53,8 @@ class ISolver
Grid *pGrid; ///< Grid to solve
const Dictionary *pDict; ///< Dictionary to use

uint8_t mSx, mSy; ///< Grid size
uint64_t seed; ///< Seed for the random generator
uint8_t mSx, mSy; ///< Grid size
uint64_t steps; ///< Number of steps during the generation
};

Expand Down
18 changes: 9 additions & 9 deletions Sources/Solvers/SolverStatic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ bool SolverStatic::ChangeItemWord (StaticItem &item, uint8_t mask [], int unvali
// There is no guarantee, for example: if we must change 'A' in 'SABLER', we could still get 'TABLER'
if (unvalidatedIdx >= 0 && letterToChange == item.word [unvalidatedIdx]) continue;

// Check the word is not already on the grid
if (item.length > 1);
// Check the word is not already on the grid (TODO)
//if (item.length > 1);

// All conditions match
break;
Expand Down Expand Up @@ -929,19 +929,19 @@ void SolverStatic::ExcludeDefinedWords (StaticItem pList [], int listLength)
// ===========================================================================
int SolverStatic::AreDependant (const StaticItem &item1, const StaticItem &item2, uint8_t* dependencyMask)
{
unsigned char i1_xStart, i1_yStart, i1_xEnd, i1_yEnd;
unsigned char i2_xStart, i2_yStart, i2_xEnd, i2_yEnd;
unsigned char i1_xStart, i1_y, i1_xEnd;
unsigned char i2_xStart, i2_y, i2_xEnd;
int connect = 0;
int i, j;

// Start and end coordinates for item 1
i1_xEnd = i1_xStart = item1.posX;
i1_yEnd = i1_yStart = item1.posY;
i1_y = item1.posY;
i1_xEnd += item1.length -1;

// Start and end coordinates for item 2
i2_xEnd = i2_xStart = item2.posX;
i2_yEnd = i2_yStart = item2.posY;
i2_y = item2.posY;
i2_xEnd += item2.length -1;

// Clear mask
Expand All @@ -958,19 +958,19 @@ int SolverStatic::AreDependant (const StaticItem &item1, const StaticItem &item2
// Start and end Coordinates of the adjacent letters
int s = (i1_xStart > i2_xStart) ? i1_xStart : i2_xStart;
int e = (i1_xEnd < i2_xEnd) ? i1_xEnd : i2_xEnd;
int step = (i1_yStart < i2_yStart) ? 1 : -1;
int step = (i1_y < i2_y) ? 1 : -1;

// Check each boxes for the adjacent letters
for (i = s; i <= e; i ++)
{
// Test the vertical path between both words
for (j = i1_yStart +step; j != i2_yStart; j+= step)
for (j = i1_y +step; j != i2_y; j+= step)
{
if ( (*pGrid) (i, j)->IsBloc () ) break;
}

// If no block in between
if (j == i2_yStart)
if (j == i2_y)
{
// Mark the mask with a '*'
if (dependencyMask != nullptr) dependencyMask [i - i1_xStart] = '*';
Expand Down
2 changes: 1 addition & 1 deletion Sources/library.Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/// \brief An independent module for solving grids
// ###########################################################################

#include "Library.Module.h"
#include "library.Module.h"


// ###########################################################################
Expand Down
2 changes: 1 addition & 1 deletion Sources/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/// \brief Singleton holding all the Wizium instances
// ###########################################################################

#include "Library.h"
#include "library.h"
#include "library.Module.h"


Expand Down

0 comments on commit 0b48d6c

Please sign in to comment.