// Wingo Big/Small Prediction App (Upgraded) import React, { useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; export default function WingoPredictor() { const [history, setHistory] = useState([]); const [prediction, setPrediction] = useState(null); const [stats, setStats] = useState({}); const [accuracyThreshold, setAccuracyThreshold] = useState(70); const addResult = (value) => { const newHistory = [value, ...history]; setHistory(newHistory); calculatePrediction(newHistory); }; const calculatePrediction = (data) => { if (data.length < 4) return setPrediction(null); const patterns = {}; for (let i = 0; i < data.length - 3; i++) { const pattern = data.slice(i + 1, i + 4).join("-"); const next = data[i]; if (!patterns[pattern]) { patterns[pattern] = { Big: 0, Small: 0 }; } patterns[pattern][next]++; } const currentPattern = data.slice(0, 3).join("-"); const currentStats = patterns[currentPattern]; if (!currentStats) return setPrediction(null); const total = currentStats.Big + currentStats.Small; const bigAcc = (currentStats.Big / total) * 100; const smallAcc = (currentStats.Small / total) * 100; let pred = null; if (bigAcc >= accuracyThreshold || smallAcc >= accuracyThreshold) { pred = bigAcc > smallAcc ? "BIG" : "SMALL"; } setPrediction({ value: pred, acc: Math.max(bigAcc, smallAcc).toFixed(1), count: total }); setStats(patterns); }; return (

Wingo Big/Small Predictor

{prediction && ( Tebakan Berikutnya:
{prediction.value}
Akurasi: {prediction.acc}% (dari {prediction.count} pola)
)}
setAccuracyThreshold(Number(e.target.value))} />

Riwayat Input:

{history.map((item, idx) => ( {item} ))}

Statistik Pola:

    {Object.entries(stats).map(([key, value]) => { const total = value.Big + value.Small; const acc = ((Math.max(value.Big, value.Small) / total) * 100).toFixed(1); return (
  • {key}: Big {value.Big}x, Small {value.Small}x – Akurasi tertinggi: {acc}%
  • ); })}
); }