Esempio n. 1
0
///
/// \brief PuzzleGame::isRowValid
/// \param row
/// \return true if the row respects the game constraints
///
bool PuzzleGame::isRowValid(int row)
{
    if(isRowComplete(row))
        if(!isRowBalanced(row) || !isRowUnique(row))
            return false;

    return true;
}
std::vector<CatheterChannelCmd> CatheterCmdGrid::getCommands() {
    std::vector<CatheterChannelCmd> cmdVect;
    for (int i = 0; i < cmd_count; i++) {
        if (isRowComplete(i)) {
            cmdVect.push_back(getCommand(i));
        }
    }
    return cmdVect;
}
CatheterChannelCmd CatheterCmdGrid::getCommand(int cmd_num) {
    CatheterChannelCmd cmd;
    if (!(cmd_num < cmd_count)) {
        wxLogError(wxT("Error retrieving command; requested command number too high"));
    } else if (!isRowComplete(cmd_num)) {
        wxLogError(wxT("Error retrieving command; requested command number is incomplete"));
    } else {
        cmd.channel = getCommandChannel(cmd_num);
        cmd.currentMA = getCommandCurrentMA(cmd_num);
        cmd.delayMS = getCommandDelay(cmd_num);
        cmd.poll = false;
        //debug
        wxMessageBox(wxString::Format("chan: %d  MA: %3.3f  MS: %d", cmd.channel, cmd.currentMA, cmd.delayMS), "");
    }
    return cmd;
}