Hello,
I'm starting on BGA as a developer but I'm not a novice developer. I proposed a feature on Quarto when I arrived: Add an expert mode.
I don't know who manages the code of Quarto but here are the modifications to do to add the feature I proposed:
quarto.game.php
gameoptions.inc.php
quarto.po
I'm starting on BGA as a developer but I'm not a novice developer. I proposed a feature on Quarto when I arrived: Add an expert mode.
I don't know who manages the code of Quarto but here are the modifications to do to add the feature I proposed:
quarto.game.php
Code: Select all
protected function checkForVictory($grid) {
//columns
for ($x = 0; $x < 4; $x++) {
$spaces = array(array($x, 0), array($x, 1), array($x, 2), array($x, 3));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
}
//rows
for ($y = 0; $y < 4; $y++) {
$spaces = array(array(0, $y), array(1, $y), array(2, $y), array(3, $y));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
}
//horizontal
$spaces = array(array(0, 0), array(1, 1), array(2, 2), array(3, 3));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
//vertical
$spaces = array(array(3, 0), array(2, 1), array(1, 2), array(0, 3));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
if (self::getGameStateValue('advanced_variant') == 2) {
for ($x = 0; $x < 3; $x++) {
for ($y = 0; $y < 3; $y++) {
$spaces = array(array($x, $y), array($x, $y+1), array($x+1, $y), array($x+1, $y+1));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
}
}
}
if (self::getGameStateValue('advanced_variant') == 3) {
//Squares 3x3
for ($x = 0; $x < 2; $x++) {
for ($y = 0; $y < 2; $y++) {
$spaces = array(array($x, $y), array($x, $y+2), array($x+2, $y), array($x+2, $y+2));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
}
}
//Square 4x4
$spaces = array(array(0, 0), array(0, 3), array(3, 0), array(3, 3));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
//Rhombus
for ($x = 0; $x < 2; $x++) {
for ($y = 0; $y < 2; $y++) {
$spaces = array(array($x, $y+1), array($x+1, $y), array($x+2, $y+1), array($x+1, $y+2));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
}
}
//Quares in L #1
$spaces = array(array(1, 0), array(3, 1), array(0, 2), array(2, 3));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
//Quares in L #2
$spaces = array(array(2, 0), array(0, 1), array(3, 2), array(1, 3));
$result = self::checkCountsOnSpaces($grid, $spaces);
if ($result != null) return array($spaces, $result);
}
return null;
}
Code: Select all
$game_options = array(
100 => array(
'name' => totranslate('Game variant'),
'values' => array(
// A simple value for this option:
1 => array( 'name' => totranslate('Standard'), 'tmdisplay' => totranslate('Standard') ),
// A simple value for this option.
// If this value is chosen, the value of "tmdisplay" is displayed in the game lobby
2 => array( 'name' => totranslate('Advanced (2x2)'), 'tmdisplay' => totranslate('Advanced (2x2)') )
// A simple value for this option.
// If this value is chosen, the value of "tmdisplay" is displayed in the game lobby
3 => array( 'name' => totranslate('Expert'), 'tmdisplay' => totranslate('Expert') )
)
)
Code: Select all
msgid "Expert"
msgstr "Expert"