function validValuesFor($board, $coord)
{
    $all_values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
    if (hasValue($board, $coord)) {
        return [];
    }
    $union = array_unique(array_merge(rowValues($board, $coord), colValues($board, $coord), blockValues($board, $coord)));
    return array_values(array_diff($all_values, $union));
}
Esempio n. 2
0
 public function createSubmitButton($nombre = 'submitPayment', $texto = 'Enviar')
 {
     if (!hasValue($nombre)) {
         throw new Exception('Asigne nombre al boton submit');
     }
     $btnsubmit = '<input type="submit" name="' . $nombre . '" id="' . $nombre . '" value="' . $texto . '" />';
     $this->_submit = $btnsubmit;
 }
/**
 * @param mixed $value
 * @return \Closure
 */
function hasNotValue($value)
{
    return negate(hasValue($value));
}
 public function test_hasValue()
 {
     $this->assertEquals(true, hasValue([[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], [0, 6, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 4, 1, 9, 0, 0, 5], [0, 0, 0, 0, 8, 0, 0, 7, 9]], [0, 0]));
     $this->assertEquals(false, hasValue([[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], [0, 6, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 4, 1, 9, 0, 0, 5], [0, 0, 0, 0, 8, 0, 0, 7, 9]], [0, 3]));
 }
Esempio n. 5
0
 function isPatent($PATENT_ID = '')
 {
     $sql = 'SELECT PATENT_ID FROM TABLE_PREFIX.PATENT WHERE PATENT_ID = ?';
     $results = $this->CONN->getRecordSet($sql, array($PATENT_ID));
     if (!$results or !hasValue($results)) {
         return false;
     } else {
         return true;
     }
 }