Euro 2024 Match Predictor
Matchup
Team A
VS
Team B
Game Type
Regular Game
Your Prediction
Team A Wins
Generate Winner
Predicted Winner: France
FRA V BEL
Feed Chat Matchup Lineups Stats
France
1
1-2-0, 2nd Group D
Belgium
0
1-1-1, 2nd Group E
Table
Full Table
GP W-D-L P GD
2 France
3 1-2-0 5 1
3 Belgium
3 1-1-1 4 1
Timeline
Tchouameni 14'
Griezmann 23'
Rabiot 24'
Scores Favorites Bet Leagues
Form Score Calculation
win: +1
draw: 0
loss: -1
Data
{
"teams": [
{
"country": "France",
"ranking": "2",
"flag": "https://cdn.britannica.com/82/682-004-F0B47FCB/Flag-france.jpg",
"last5Games": [1, 0],
"goalDifference": 1
},
{
"country": "Belgium",
"ranking": "3",
"flag": "https://gstatic.com/images?q=tbn:ANd9GcSbAA7WKpxLrx145FWQ7-AzUIcrM8uNDKTqqQ6s",
"last5Games": [-1, 1],
"goalDifference": 1
},
{
"country": "England",
"ranking": "5",
"flag": "https://cdn.britannica.com/44/344-058-94536674/Flag-england.jpg",
"last5Games": [1, 0],
"goalDifference": 1
}
]
}
hero.tsx
data.json
data.json
teams
{
"teams": [
{
"country": "France",
"ranking": "2",
"flag": "https://cdn.britannica.com/82/682-004-F0B47FCB/Flag-france.jpg",
"last5Games": [1, 0],
"goalDifference": 1
},
{
"country": "Belgium",
"ranking": "3",
"flag": "https://gstatic.com/images?q=tbn:ANd9GcSbAA7WKpxLrx145FWQ7-AzUIcrM8uNDKTqqQ6s",
"last5Games": [-1, 1],
"goalDifference": 1
},
{
"country": "England",
"ranking": "5",
"flag": "https://cdn.britannica.com/44/344-058-94536674/Flag-england.jpg",
"last5Games": [1, 0],
"goalDifference": 1
}
]
}
You, last week * initial
const predictedOutcome: string;
const gameType: string;
const euroTeams: Team[] = teams.teams.map(
(team) => (
{
...team,
ranking: parseInt(team.ranking, 10)
}
)
);
const getTeamData = (country: string): Team | undefined => {
return euroTeams.find(team => team.country === country);
}
const calculateScore = (team: Team): number => {
const formScore = team.last5Games.reduce(
(acc, game) => acc + game, 0
);
const rankingScore = 100 - team.ranking;
return formScore + rankingScore + team.goalDifference;
}
const predictWinner = (userPrediction: UserPrediction): string => {
const teamA = getTeamData(userPrediction.teamA);
const teamB = getTeamData(userPrediction.teamB);
if (!teamA || !teamB) {
return "Invalid teams";
}
const teamAScore = calculateScore(teamA);
const teamBScore = calculateScore(teamB);
const adjustedTeamAScore = userPrediction.predictedOutcome === "A" ? teamAScore * 1.1 : teamAScore;
const adjustedTeamBScore = userPrediction.predictedOutcome === "B" ? teamBScore * 1.1 : teamBScore;
if (userPrediction.gameType === "Regular") {
const scoreDifference = Math.abs(adjustedTeamAScore - adjustedTeamBScore);
Rk. Team PTS More
1 ARG 1860.14
2 FRA 1837.47
3 BEL 1797.98
4 BRA 1791.85
5 ENG 1787.88
6 POR 1747.04
7 NED 1746.66
8 ESP 1729.92