Menu

#1 Phase validation error

open
nobody
None
5
2009-01-07
2009-01-07
No

A known error when validating the phase in the selected cards from the hand arises when the phases are not in the same order as the phase description.

Example:
The phase description is a "Set of 5" and "Set of 3"

Cards in the hand are: G1 Y1 Y1 R4 Y4 R4 G10 B10 R10 B10 BW

Clearly the phase would be valid if the user selects the set of 1s or 4s and the set of 10s with the wild, but since the set of 10s is placed in the second set (a Set of 3) both parts of the phase fail validation.

A workaround for the user would be to sort the hand so the Set of 5 is before the Set of 3 in the hand, as such:

G10 B10 R10 B10 BW G1 Y1 Y1 R4 Y4 R4

The portion of code creating this issue is likely located in ../src/Game/Phase.cpp

I have identified a possible solution that may be applied to Phase::IsValid to resolve this issue.

bool Phase::isValid(THand* phaseA, THand* phaseB, int phase) {
PHASE_TYPE type1, type2;
int size1,size2;
phaseRequirements ( phase, &type1, &size1, &type2, &size2 );
// there is always part1 required
wxASSERT ( type1 != ptNONE );
if ( !isValid ( phaseA, type1, size1 ) && !isValid ( phaseB, type1, size1 ) )
return false;
if ( type2 != ptNONE && ( !isValid ( phaseB, type2, size2 ) && !isValid ( phaseA, type2, size2 ) ) )
return false;
return true;
}

Discussion


Log in to post a comment.