This commit is contained in:
Wiesner András 2025-10-14 15:06:23 +02:00
parent 4814c357eb
commit aeee5b5275
3 changed files with 8 additions and 5 deletions

View File

@ -48,6 +48,9 @@ class LogicUtils
}
} else {
$numa_str = self::extend($numa_str, $base, $digits, false);
if (($rep === "c") && ($numa_str[0] >= ($base / 2))) {
$numa_str = str_pad($numa_str, 1, "0", STR_PAD_LEFT);
}
}
return $numa_str;
}

View File

@ -14,7 +14,11 @@ class LogicFunctionTask extends LogicTaskBase
if (!$this->hasFlag("dnf")) {
$this->setCorrectAnswer($this->getLogicFunction()->getExpression());
} else {
$this->setCorrectAnswer($this->getLogicFunction()->toDNF());
$dnf = $this->getLogicFunction()->toDNF();
if ($dnf === "") {
$dnf = "0";
}
$this->setCorrectAnswer($dnf);
}
}

View File

@ -89,10 +89,6 @@ class LogicTaskBase extends PicturedTask
$this->lf = LogicFunction::genRandomDNF(LuaUtils::l2pA($input_vars));
}
public function getFunctionAsDNF(): string {
return $this->lf->toDNF();
}
public function setLogicFunctionExpr(string $expr, array $input_vars = []): void {
$this->lf = new LogicFunction($expr, LuaUtils::l2pA($input_vars));
}