In our office, we regularly enjoy some rounds of foosball / table football after work. I have put together a small java program that generates random 2vs2 lineups from the available players and stores the match results in a database afterwards.
The current prediction of the outcome uses a simple average of all previous match results from the 4 involved players. This gives a very rough estimation, but I'd like to replace it with something more sophisticated, taking into account things like:
- players may be good playing as attacker but bad as defender (or vice versa)
- players do well against a specific opponent / bad against others
- some teams work well together, others don't
- skills change over time
What would be the best algorithm to predict the game outcome as accurately as possible?
Someone suggested using a neural network for this, which sounds quite interesting... but I do not have enough knowledge on the topic to say if that could work, and I also suspect it might take too many games to be reasonably trained.
EDIT:
Had to take a longer break from this due to some project deadlines. To make the question more specific:
Given the following mysql table containing all matches played so far:
table match_result
match_id int pk
match_start datetime
duration int (match length in seconds)
blue_defense int fk to table player
blue_attack int fk to table player
red_defense int fk to table player
red_attack int fk to table player
score_blue int
score_red int
How would you write a function predictResult(blueDef, blueAtk, redDef, redAtk) {...}
to estimate the outcome as closely as possible, executing any sql, doing calculations or using external libraries?