|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Klass Prova. |
|
5
|
|
|
* @author Niklas Dougherty |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
declare(strict_types=1); |
|
9
|
|
|
|
|
10
|
|
|
namespace Tips\Moduler\TT\TTGridGenerera; |
|
11
|
|
|
|
|
12
|
|
|
use Tips\Moduler\TT; |
|
13
|
|
|
use Tips\Moduler\TT\TTReduceradKod; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Klass Prova. |
|
17
|
|
|
*/ |
|
18
|
|
|
class Prova { |
|
19
|
|
|
/** @var string[] $täckningskod */ public array $täckningskod; |
|
20
|
|
|
protected TTReduceradKod $tt_reducerad_kod; |
|
21
|
|
|
|
|
22
|
|
|
public function __construct(protected TT $tt) { |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Pröva reduktion. |
|
27
|
|
|
*/ |
|
28
|
1 |
|
protected function pröva_reduktion(string $tipsrad_012): bool { |
|
29
|
1 |
|
return isset($this->tt_reducerad_kod->reducerad_kod[$this->tt_reducerad_kod->reducera_kodord($tipsrad_012)]); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Pröva täckningsgrad. |
|
34
|
|
|
*/ |
|
35
|
|
|
protected function pröva_täckningskod(string $tipsrad_012): bool { |
|
36
|
|
|
return in_array($tipsrad_012, $this->täckningskod, true); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Pröva spikar. |
|
41
|
|
|
*/ |
|
42
|
|
|
/** @param array<int, array<int, string|null>> $spikar */ |
|
43
|
1 |
|
protected function pröva_spikar(array $spikar, int $andel_spikar, string $tipsrad_012): bool { |
|
44
|
1 |
|
$andel_spikade = 0; |
|
45
|
1 |
|
foreach ($spikar as $i => $s) { |
|
46
|
1 |
|
if ($s[(int) $tipsrad_012[$i]] > '') { |
|
47
|
1 |
|
$andel_spikade++; |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
1 |
|
return $andel_spikade >= $andel_spikar; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Pröva teckenintervall. |
|
56
|
|
|
*/ |
|
57
|
|
|
protected function pröva_teckenintervall(string $tipsrad_012): bool { |
|
58
|
|
|
$antal_1 = substr_count($tipsrad_012, '0'); |
|
59
|
|
|
$antal_X = substr_count($tipsrad_012, '1'); |
|
60
|
|
|
$antal_2 = substr_count($tipsrad_012, '2'); |
|
61
|
|
|
return in($antal_1, $this->tt->antal_1_min, $this->tt->antal_1_max) && |
|
62
|
|
|
in($antal_X, $this->tt->antal_X_min, $this->tt->antal_X_max) && |
|
63
|
|
|
in($antal_2, $this->tt->antal_2_min, $this->tt->antal_2_max); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Pröva oddsintervall. |
|
68
|
|
|
*/ |
|
69
|
|
|
protected function pröva_oddsintervall(string $tipsrad_012): bool { |
|
70
|
|
|
return in(antal_rätt($tipsrad_012, $this->tt->enkelrad_012), $this->tt->odds_rätt_min, $this->tt->odds_rätt_max); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|