Added a few convenience methods.
This commit is contained in:
parent
bea2387b68
commit
0ba36860ad
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2007-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -280,6 +280,13 @@ SudokuField::HintMaskAt(uint32 x, uint32 y) const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SudokuField::HasHint(uint32 x, uint32 y, uint32 value) const
|
||||
{
|
||||
return (_FieldAt(x, y).hint_mask & (1UL << (value - 1))) != 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SudokuField::SetValidMaskAt(uint32 x, uint32 y, uint32 validMask)
|
||||
{
|
||||
@ -294,6 +301,13 @@ SudokuField::ValidMaskAt(uint32 x, uint32 y) const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SudokuField::IsValid(uint32 x, uint32 y, uint32 value) const
|
||||
{
|
||||
return (_FieldAt(x, y).valid_mask & (1UL << (value - 1))) != 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SudokuField::SetFlagsAt(uint32 x, uint32 y, uint32 flags)
|
||||
{
|
||||
@ -308,6 +322,13 @@ SudokuField::FlagsAt(uint32 x, uint32 y) const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SudokuField::IsInitialValue(uint32 x, uint32 y) const
|
||||
{
|
||||
return (_FieldAt(x, y).flags & kInitialValue) != 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SudokuField::SetValueAt(uint32 x, uint32 y, uint32 value, bool setSolved)
|
||||
{
|
||||
|
@ -41,13 +41,16 @@ public:
|
||||
void SetHintMaskAt(uint32 x, uint32 y,
|
||||
uint32 hintMask);
|
||||
uint32 HintMaskAt(uint32 x, uint32 y) const;
|
||||
bool HasHint(uint32 x, uint32 y, uint32 value) const;
|
||||
|
||||
void SetValidMaskAt(uint32 x, uint32 y,
|
||||
uint32 validMask);
|
||||
uint32 ValidMaskAt(uint32 x, uint32 y) const;
|
||||
bool IsValid(uint32 x, uint32 y, uint32 value) const;
|
||||
|
||||
void SetFlagsAt(uint32 x, uint32 y, uint32 flags);
|
||||
uint32 FlagsAt(uint32 x, uint32 y) const;
|
||||
bool IsInitialValue(uint32 x, uint32 y) const;
|
||||
|
||||
void SetValueAt(uint32 x, uint32 y, uint32 value,
|
||||
bool setSolved = false);
|
||||
|
Loading…
Reference in New Issue
Block a user