ruleta de una pagina de apuestas
Publicado por chuz (1 intervención) el 04/07/2017 04:40:06
hola como estan conseguí el código de la ruleta de un pagina de apuestas. Mi duda es que si hay una forma de saber que color va caer o predecir mediante el análisis del código saludos :)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
function hashFromUrl() {
if (!location.search) return;
var res = location.search.substr(1).split("&")
.map(x => x.split("=")).find(([k, v]) => k === "hash");
if (res) return res[1];
}
class UI extends React.Component {
state = {hash: hashFromUrl() || "", amount: 100};
setHash = e => this.setState({hash: e.target.value});
showMore = () => this.setState({amount: this.state.amount * 2});
render() {
const {hash, amount} = this.state;
const [current, ...previous] = getPreviousResults(hash, amount);
return (
<div>
<table>
<thead>
<tr>
<th>Game hash</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label>
First hash: <input value={this.state.hash} onChange={this.setHash} />
</label>
</td>
{hash && <Result {...current} />}
</tr>
{hash &&
previous.map(result =>
<tr key={result.hash}>
<td><pre>{result.hash}</pre></td>
<Result {...result} />
</tr>
)}
</tbody>
</table>
{hash && <button onClick={this.showMore}>Show more</button>}
</div>
);
}
}
const Result = result =>
<td style={{background: result.color}}>
{result.result}{result.bonus && ' (Bonus)'}
</td>;
function getPreviousHash(gameHash) {
return CryptoJS.SHA256(gameHash).toString();
}
function isRoundBonusRound(seed) {
const num = parseInt(seed.substr(52 / 4, 52 / 4), 16);
return (num % 100) === 0;
}
function gameResultToColor(bet) {
if (bet === 0) return "green";
if (1 <= bet && bet <= 7) return "red";
if (8 <= bet && bet <= 15) return "black";
}
const salt = "0000000000000000019ee980eb5c43e1e4e9d16bee8bb96d9ee691fa2c49c219";
function saltHash(hash) {
return CryptoJS.SHA256(JSON.stringify([hash, salt])).toString();
}
function gameResultFromSeed(seed) {
// warning: slightly biased because of modulo!
const num = parseInt(seed.substr(0, 52 / 4), 16);
return num % 15;
}
function getGameInformation(hash) {
const seed = saltHash(hash), result = gameResultFromSeed(seed);
return {
result, hash, seed,
color: gameResultToColor(result),
bonus: isRoundBonusRound(seed),
};
}
function getPreviousResults(gameHash, count) {
const results = [];
for (let i = 0; i < count; i++) {
results.push(getGameInformation(gameHash));
gameHash = getPreviousHash(gameHash);
}
return results;
}
ReactDOM.render(<UI />, document.querySelector("#ui"));
Valora esta pregunta


0