Predict chances of winning or losing in a Chess Game [closed] - algorithm

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I play chess most days at chess.com and was wondering how an algorithm might predict the result of my next game based on all my chess history at this site: my ratings when playing the previous games, the opponent rating, and whether I won or lost.
Thanks,
Roberto Falk

If you are searching for a way to estimate your skill and the skill of your opponent, look for the Elo-Rating. It was actually developed for that purpose (chess). The Elo-rating changes based on which games you won and lost (and against which opponent, based on their Elo-Rating).
That means, if you win against a strong opponent (compared to your strength), your Elo-Rating will improve a lot. If you win against a weak opponent, your Elo-Rating will improve almost not at all.
The problem is, how to get the Elo-Rating of your opponents. If the website does not offer it, the only way is to compute it yourself. However, you would need ALL games of ALL the players on this website to find out how good they really are. Just the number of won/lost games is worthless if you don't factor in the skill of the opponent. If someone won 100 games against a beginner, he doesn't have to be very good. If someone won 100 games against a very good player, he is much better.
If you are searching for a way to estimate the current state of a game while playing (i.e. who is more likely to win after some moves were executed), there are several popular heuristics for chess available. The most simple ones define a value for each piece (strong pieces have a higher value). To see which player has the stronger board, just sum up the values of their pieces.
For some more heuristics (and probably other programming ideas), see here: https://www.chessprogramming.org
There are several very good approaches to estimate the value of a board, much more than I could reasonably write up in an answer.

Related

Optimal algorithm to lose game 2048 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
By now, especially after this post and other similar internet resources, I guess most people have figured out how to easily win at Gabriele Cirulli's game 2048: even manually, by observing simple rules, reaching 2048 is not a problem.
However, losing at this game seems far more challenging than winning! As much as I try, the minimum tile I got so far was 16. It seems to me that losing depends on chance much more than winning. Is there any strategy that can guarantee to lose with no tile more than 8?
(Of course, some of the hints suggested here might help, such as calculating all possible moves for n steps and choosing the combination of moves that maximises the probability to get the tiles stuck and end the game. But is there a more logical principle to obtain that?)
In the luckiest case, you would alternate 2s and 4s; alternating 2s, 4s and 8s should be easier. Actually I have just made it with five 8s, seven 4s and four 2s.

Have any commercial video games ever used Prolog? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Have any commercial video games ever used Prolog? With is rules-based logic based model it seems like it have some place in the industry.
PS: as odd as this question is it still meets all the criteria for a question on SO.
Not a commercial game, but I was in a game jam just this last weekend, and we wrote the entire game (a small MMO) in Prolog. It's probably only a fantasy, but we discussed expanding the game into a game engine. That game engine would be rule based.
I guess I should add that I've worked on prolog systems that were near real time.
I work in the game industry and I doubt it very much. I have seen only one guy use prolog and it was for a build bot rule to automerge git branches into subproducts and overversions, and not in a game company.
That said, it could make sense for some fuzzy AI, but everything related to AI in the business is far from the research papers in practice. Real game developpers and producers hate unpredictability, basically for business reasons, today games are merely interactive movies.
Everything is on rail, scripted and controlled. Artists are very uncomnfortable with algorithmical rules, and game designers are artists. In my programmer's opinion, games with sophisticated AI must have beneficiated from a high ranking programmer in the company to push for it.
Or the game really required it, for example hitman. However if you see some of their talks (they have presentations at GDC, Cedec...) they say most of their work is empirical, and I tend to think by that, made in typical imperative programming.
Thirdly, you also get the problem of maintenance, and people knowing the language, which is.. few. Most of computer science graduates will have heard of it, followed some tutorial at the school/university but quickly forgotten about it anyway later. And you see, in game companies, a good percentage of programmers are self made, and even drop outs ! This leaves little room for prolog I can tell you that.
Lastly, you need to think about a technical point : performance. prolog underlying execution machine is somekind of a danger to real time. Because it has this simplex solver based on tree branches elimination heuristics which can run for god knows how long. Most games make scarse use of multi threading because of platforms limitation, or because of synchronization problems with the game data which has to be in synch on a by-frame basis for lots of things.

Rating System for multiple competitors [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have been doing a research on various rating systems. I have found some good ones like Elo Rating system and Glicko Rating system. But all of these system are designed for a games which involve 2 competitors. ( chess, go)
I would like to know if there are any algorithms available for games involving N players, or if there is a way above systems can be extended to support N player games.
This is the closet thing I have found so far:
http://sradack.blogspot.com/2008/06/elo-rating-system-multiple-players.html
Assuming the game results in a ranking of all players (rather than just determining a single winner, say), you could treat the single game as N(N-2)/2 individual two-player games in which 1st place beat everyone else, 2nd place beat 3rd, 4th, and so on. You can then apply one of the 2-player algorithms to each of these individual games.
You would probably want to reduce the weighting of rating changes because this gives many "games" worth of ratings changes for each game played. Perhaps the changes should be reduced by a factor of N since each player is rated as having played N games, then again, maybe it makes sense to weight games among more players more heavily.
I have no idea whether this produces a rating system that is actually useful, but it is certainly possible to extend 2-player systems to the N-player case.

How to simulate Nash equilibria [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a N person game where each person has a set of M discrete strategies. I know from the theory that at least one mixed strategy Nash Equilibrium exists.
Can someone please tell me how do I find one of those equilibrium points by numerical simulation?
I can not find in the book any explanation of how to simulate. I just need the basic direction.
I asked this question in math.stackexchange but decided to ask here as well in case this is the correct place for algorithms.
Thank you.
It depends of the game you have, in some case it is not possible and in other (2xN zero-sum games, potential game) it can be costly.
If the game has a pure Nash Equilibrium then the Fictitious play algorithm of Brown then then improved by Berger can find it [G. W. Brown, Iterative solution of games by fictitious play, MIT Press, 1998 and Berger, Brown's original fictitious play, Journal of Economic Theory, 2007]. A stichastic version of it has been proposed by Smyrnakis & Leslie [Michail Smyrnakis et David Leslie, Stochastic Fictitious Play using Particle Filters to update the beliefs of opponents strategies, 2008]. You can browse the wikipedia page at first : http://en.wikipedia.org/wiki/Fictitious_play.
If you are looking for a mixed NE it is even more tricky and some learning algorithm can be quite bad while others are better. I personnally like the book of Cesa-Bianchi and Lugosi, Prediction, Learning and Games, http://homes.di.unimi.it/~cesabian/predbook/. Other people like also Nisan's Algorithmic Game Theory.

Given two teams with stats, what's the logic to determine the winner? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Should be simple enough, but I can't get my head around the math required.
Let's say you have Team 1 (80 overall) vs. Team 2 (70 overall).
Using only those two variables, what's the best/fairest way of determining a winner? Obviously, the higher the overall, the better the chance Team 1 should have to win.
I've been trying to look up answers, but unfortunately I don't exactly know the word or phrasing of what I'm trying to figure out.
Just looking for a logic, or if someone can point me in the right direction of searching, that would be great.
Edit: Basically, in a match of Team 1 vs. Team 2, how can I calculate the winner when the only stat I'm given is the overall of each? Overall meaning the teams overall rating out of 100. (think sports team, the players ratings average is the teams overall rating).
The question is unclear because you haven't defined an criteria for how the winner is selected. If the winner is the team with the highest overall ranking then it's pretty straight forward, team one wins. If you're doing some sort of weighted drawing -- like the NBA draft lottery -- where the team with the higher score has more chances of winning the drawing then you'd just think of it like pieces of paper in a bowl. Team 1 gets 8 pieces, Team 2 gets 7 pieces. There are 15 pieces in the bowl and Team A has 8/15 or 53% chance of having one of its pieces picked out. Add in a Team 3 with say a 30 ranking so they get 3 pieces of paper. Now there are 18 in the bowl and Team 1 has a 8/18 or 44.4% chance of winning.
If that's what you're after then you can write a formula for picking weighted random winners -- random choices but where one team has a greater chance of being selected than another.

Resources