101 points · by atum47 · 7y ago · 63 comments
The code updates x and y, then trains the model, and then makes a prediction. “Fair” code would make a prediction, then update x and y and train the model
This explains the behavior mentioned in the comments where the computer gets an impressive early lead due to the players next move being one of only a few datapoints it learns from, then backs off to a more plausible advantage as the leaked data is diluted by past data.
500 plays - Player: 144, Computer: 179, Tie: 177
1000 plays - Player: 325, computer: 359, tie: 316
500 plays - Player: 163, Computer: 179, Tie: 158
1000 plays - Player: 306, Computer: 365, Tie: 329
I've run it several times and the computer has won every time against random, it must have an unfair advantage.
https://gist.github.com/mbrumlow/49f0a3fa311cc3002e4e1fae2e2...
const times = 1000;
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
async function run() { for (let i = 0; i < times; i++) { await sleep(10); play(Math.floor(Math.random()*3)); } }
run();
This is kind of a shot in the dark because I am not familiar with RPS strategy, but I think it makes sense.
You’re essentially saying that a good neural network can predict the next value of a good random number generator. Good luck with that one!
Maybe while you’re at it, have neural networks invert cryptographically secure hash functions :)
I’m basically suggesting a predictable distribution can be exploited in RPS.
Honestly, the bot could always be winning against the RNG by dumb luck. More experimentation would be needed to be sure. I am just making guesses.
I am under the impression that you can't game random -- unless you are aware of the random generator being used is broken..
I'm unaware of the name of the property that RPS exhibits that makes it ungameable by a random opponent (zero-sum?) but ordinary RPS played by humans certainly doesn't exhibit it, only in the magic world of computers where things like simultaneity of play can be guaranteed does RPS exhibit that property.
If played in the real world like real humans traditionally played it, ongoing RPS matches between a human and an AI would soon see the AI dominating. I'd be very curious to see what real-world RPS would look like between two AIs that can 'explain their model'.
Imagine making a rule that gives a Xms window for making plays. Then strategy can start to emerge.
A good random distribution actually gives more and longer runs than a human trying to appear random.
Not sure a bigram or trigram model would not do better than the neural network.
I can’t fully put my head around this, but what would it be like if each AI could read the architecture of the other’s brain before each move. The AI’s would be permitted to reconfigure themselves as they play. An “obvious” strategy may be to simulate your opponent and ask what they are likely to play. Though, simulating their behavior is likely to involve you simulating someone else simulating your behavior, ad-infinium, until your computing resources bottom out. It is like fighting the man in the mirror who can choose to mirror you or not.
day | visits | pages | hits | bytes
26 Jul 2019 | 4,688 | 16,507 | 60,489 | 163.89 MB
Not enough trials or is there something else going on here?
1. Humans aren't good at random, try using a RNG or dice.
2. If you toss 10 coins, what is the probability of 5 heads and 5 tails? It isn't very likely, even though it's the most likely outcome.
Player: 144, Computer: 179, Tie: 177,
Although I think I got more equal results when I did 1000 iterations, but failed to record that one.
I was right.