Created
April 11, 2024 01:40
-
-
Save denisdemaisbr/32b433602179d5374feb3eb77825dee3 to your computer and use it in GitHub Desktop.
apurador para o formato recibo `Imperial`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apurador para o formato recibo `Imperial` 16~23 dezenas*/ | |
require_once('vendor/autoload.php'); | |
function main() { | |
$climate = new League\CLImate\CLImate; | |
$sorteio = "01 03 04 06 07 09 12 13 14 15 16 17 20 22 25"; | |
$file = 'Recibo 2084138 - d.txt'; | |
$mark = 'LI - LOTINHA'; | |
$data = [ | |
[ '#', 'dots', 'palpite', 'diff' ] | |
]; | |
$climate->out("*** " . $sorteio . " ***"; | |
// $climate->out("*** " . $file . " ***"; | |
$fp = fopen($file, 'r'); | |
$count = 0; | |
$sorteio = explode(" ", $sorteio); | |
for ($i=0; $i<count($sorteio); $i++) { | |
$sorteio[$i] = sprintf("%02d", $sorteio[$i]); | |
} | |
while (($buffer = fgets($fp, 4096)) !== false) { | |
$buffer = trim($buffer); | |
if ($buffer != $mark) { | |
continue; | |
} | |
$count += 1; | |
$r1 = trim(fgets($fp, 4096)); | |
$r2 = trim(fgets($fp, 4096)); | |
$r3 = trim(fgets($fp, 4096)); | |
$res = ''; | |
if (strpos($r3, "QTDE") === false) { | |
$res = sprintf("%s %s %s", $r1, $r2, $r3); | |
} else { | |
$res = sprintf("%s %s", $r1, $r2); | |
} | |
$palpite = explode(" ", $res); | |
for ($i=0; $i<count($palpite); $i++) { | |
$palpite[$i] = sprintf("%02d", $palpite[$i]); | |
} | |
$dots = count(array_intersect($sorteio, $palpite)); | |
$diff = array_diff($sorteio, $palpite); | |
$data[] = [ | |
$count, | |
$dots == 15 ? "##" : $dots, | |
implode(' ', $palpite), | |
implode(' ', $diff) | |
]; | |
} | |
$climate->table($data); | |
fclose($fp); | |
} | |
main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php apura.php | |
*** 01 03 04 06 07 09 12 13 14 15 16 17 20 22 25 *** | |
------------------------------------------------------------------------------------------ | |
| # | dots | palpite | diff | | |
------------------------------------------------------------------------------------------ | |
| 1 | 14 | 01 02 03 04 05 06 07 08 09 10 11 12 14 15 16 17 19 20 21 22 23 24 25 | 13 | | |
------------------------------------------------------------------------------------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPROVANTE DE APOSTA | |
*** | |
ID APOSTA: *** | |
EMITIDO EM: 10/04/1111 04:50:43 | |
CPF: *** | |
PARTICIPANTE: *** | |
CONCURSO: 3075 | |
DATA SORTEIO: 10/04/1111 | |
HORA SORTEIO: 20:00:00 | |
LI - LOTINHA | |
1 2 3 4 5 6 7 8 9 10 | |
11 12 14 15 16 17 19 20 21 22 | |
23 24 25 | |
QTDE DEZENAS: 23 | |
VALOR APOSTADO: R$1,00 | |
GANHO MÁXIMO: R$3,00 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment