<?php
declare(strict_types=1);

require_once __DIR__ . '/_bootstrap.php';

use Zoo\Game\GameMath;
use Zoo\Game\GameConfig;

function clean_number(float $v): float
{
    return (float)number_format($v, 6, '.', '');
}

$probabilities=[];
foreach(GameMath::probabilityTable() as $k=>$v){
    $probabilities[$k]=clean_number($v);
}

$rtp=[];
foreach(GameMath::theoreticalRtpTable() as $k=>$row){
    $rtp[$k]=[
        'probability'=>clean_number((float)$row['probability']),
        'multiplier'=>(int)$row['multiplier'],
        'rtp'=>clean_number((float)$row['rtp']),
        'house_edge'=>clean_number((float)$row['house_edge'])
    ];
}

json_out([
    'ok'=>true,
    'profile'=>GameConfig::PROFILE,
    'bet_step'=>GameConfig::BET_STEP,
    'areas'=>GameMath::AREAS,
    'probabilities'=>$probabilities,
    'rtp_by_bet'=>$rtp,
    'frequency_order'=>[
        '6x most common',
        '8x',
        '12x',
        '24x Shark',
        '100x Frog rarest'
    ],
    'note'=>'RNG is independent of room bet totals. Round realized margin = total accepted stakes - all candidate/category payouts.'
]);
