| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/web31/web/slots/includes/ |
Upload File : |
<?php
/**
* Reel Royale – Europäisches Roulette (serverautoritäre Mathematik).
* Einzige Wahrheit für Radreihenfolge, Farben, legale Wetten und Auszahlungen.
*/
/** Europäische Radreihenfolge (Einzel-Null), im Uhrzeigersinn. */
function roulette_wheel(): array {
return [0,32,15,19,4,21,2,25,17,34,6,27,13,36,11,30,8,23,10,
5,24,16,33,1,20,14,31,9,22,18,29,7,28,12,35,3,26];
}
function roulette_red_numbers(): array {
return [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36];
}
function roulette_color(int $n): string {
if ($n === 0) return 'green';
return in_array($n, roulette_red_numbers(), true) ? 'red' : 'black';
}
/** Zahl an Tischposition: Spalte 0..11, Reihe 0..2 (Reihe 0 = oben). */
function roulette_grid_number(int $row, int $col): int {
return 3 * $col + (3 - $row);
}
/** Auszahlungsverhältnis (Gewinn:Einsatz) je Wett-Typ. */
function roulette_ratio(string $type): int {
return [
'straight' => 35, 'split' => 17, 'street' => 11, 'corner' => 8,
'sixline' => 5, 'column' => 2, 'dozen' => 2,
'red' => 1, 'black' => 1, 'even' => 1, 'odd' => 1, 'low' => 1, 'high' => 1,
][$type] ?? 0;
}
/**
* Alle legalen Wetten als id => Definition.
* pos: 'center' | 'bottom' (innen, fürs Layout) | 'outside' (feste Buttons).
*/
function roulette_legal_bets(): array {
$bets = [];
$add = function ($id, $type, $numbers, $pos, $label) use (&$bets) {
sort($numbers);
$bets[$id] = ['type' => $type, 'numbers' => array_values($numbers),
'ratio' => roulette_ratio($type), 'pos' => $pos, 'label' => $label];
};
// Straight Up 0..36
for ($n = 0; $n <= 36; $n++) $add('n' . $n, 'straight', [$n], 'center', (string)$n);
// Splits – horizontal (gleiche Reihe, benachbarte Spalten)
for ($row = 0; $row < 3; $row++) {
for ($col = 0; $col < 11; $col++) {
$a = roulette_grid_number($row, $col);
$b = roulette_grid_number($row, $col + 1);
$add('sp' . min($a, $b) . '_' . max($a, $b), 'split', [$a, $b], 'center', "Split $a/$b");
}
}
// Splits – vertikal (benachbarte Reihen, gleiche Spalte)
for ($col = 0; $col < 12; $col++) {
for ($row = 0; $row < 2; $row++) {
$a = roulette_grid_number($row, $col);
$b = roulette_grid_number($row + 1, $col);
$add('sp' . min($a, $b) . '_' . max($a, $b), 'split', [$a, $b], 'center', "Split $a/$b");
}
}
// 0-Splits
foreach ([1, 2, 3] as $n) $add('sp0_' . $n, 'split', [0, $n], 'center', "Split 0/$n");
// Streets (12) – je Tischspalte 3 Zahlen
for ($col = 0; $col < 12; $col++) {
$nums = [3 * $col + 1, 3 * $col + 2, 3 * $col + 3];
$add('st' . (3 * $col + 1), 'street', $nums, 'bottom', 'Street ' . (3 * $col + 1));
}
// 0-Trios (Streets mit Null)
$add('tr0_1_2', 'street', [0, 1, 2], 'center', 'Trio 0/1/2');
$add('tr0_2_3', 'street', [0, 2, 3], 'center', 'Trio 0/2/3');
// Corners (22)
for ($row = 0; $row < 2; $row++) {
for ($col = 0; $col < 11; $col++) {
$nums = [
roulette_grid_number($row, $col), roulette_grid_number($row, $col + 1),
roulette_grid_number($row + 1, $col), roulette_grid_number($row + 1, $col + 1),
];
$add('cn' . min($nums), 'corner', $nums, 'center', 'Corner ' . min($nums));
}
}
// First Four (0,1,2,3)
$add('ff0', 'corner', [0, 1, 2, 3], 'center', 'First Four');
// Six Lines (11)
for ($col = 0; $col < 11; $col++) {
$nums = [];
for ($c = $col; $c <= $col + 1; $c++) for ($k = 1; $k <= 3; $k++) $nums[] = 3 * $c + $k;
$add('sl' . (3 * $col + 1), 'sixline', $nums, 'bottom', 'Six Line ' . (3 * $col + 1));
}
// Columns (2:1)
for ($i = 0; $i < 3; $i++) {
$nums = [];
for ($col = 0; $col < 12; $col++) $nums[] = roulette_grid_number($i, $col);
$add('col' . (3 - $i), 'column', $nums, 'outside', (3 - $i) . '. Spalte 2:1');
}
// Dozens
$add('dz1', 'dozen', range(1, 12), 'outside', '1. Dutzend');
$add('dz2', 'dozen', range(13, 24), 'outside', '2. Dutzend');
$add('dz3', 'dozen', range(25, 36), 'outside', '3. Dutzend');
// Even-money
$add('low', 'low', range(1, 18), 'outside', '1–18');
$add('high', 'high', range(19, 36), 'outside', '19–36');
$add('even', 'even', array_values(array_filter(range(1, 36), function ($n) { return $n % 2 === 0; })), 'outside', 'GERADE');
$add('odd', 'odd', array_values(array_filter(range(1, 36), function ($n) { return $n % 2 === 1; })), 'outside', 'UNGERADE');
$add('red', 'red', roulette_red_numbers(), 'outside', 'ROT');
$add('black', 'black', array_values(array_diff(range(1, 36), roulette_red_numbers())), 'outside', 'SCHWARZ');
return $bets;
}
/** Serverseitige Ziehung der Gewinnzahl. */
function roulette_spin_number(): int {
return random_int(0, 36);
}
/**
* Wertet eine Einsatzliste gegen die Gewinnzahl aus.
* $betList: [['id'=>string,'amount'=>float], ...]
* Liefert total_bet, total_return, winning_ids, per_bet.
*/
function roulette_resolve(array $betList, int $number): array {
$legal = roulette_legal_bets();
$totalBet = 0.0;
$totalReturn = 0.0;
$winningIds = [];
$perBet = [];
foreach ($betList as $b) {
$id = (string)($b['id'] ?? '');
$amount = round((float)($b['amount'] ?? 0), 2);
if ($amount <= 0 || !isset($legal[$id])) continue;
$def = $legal[$id];
$totalBet += $amount;
$win = in_array($number, $def['numbers'], true);
$ret = $win ? round($amount * ($def['ratio'] + 1), 2) : 0.0;
$totalReturn += $ret;
if ($win) $winningIds[] = $id;
$perBet[] = ['id' => $id, 'type' => $def['type'], 'amount' => $amount, 'win' => $win, 'return' => $ret];
}
return [
'total_bet' => round($totalBet, 2),
'total_return' => round($totalReturn, 2),
'winning_ids' => $winningIds,
'per_bet' => $perBet,
];
}
/** Clientsichere Konfiguration (Rad, Farben, legale Wetten). */
function roulette_client_config(): array {
$wheel = roulette_wheel();
$colors = [];
for ($n = 0; $n <= 36; $n++) $colors[$n] = roulette_color($n);
return [
'wheel' => $wheel,
'colors' => $colors,
'red' => roulette_red_numbers(),
'bets' => roulette_legal_bets(),
'chips' => [1, 5, 10, 25, 50, 100, 500, 1000],
'payouts'=> [
'straight' => 35, 'split' => 17, 'street' => 11, 'corner' => 8,
'sixline' => 5, 'column' => 2, 'dozen' => 2, 'evenmoney' => 1,
],
];
}