Next up on the list of Claw To Do, Rigging it!
PSA: Most claws are Rigged in some method in the UK, that's why no matter how well that you line the claw up with the prize. The machine will make you loose. This is so that the owners make a profit.
They're actually counted as a gambling machines because of this. However on to rigging!
An easy way is for it to for every X plays allow one win. The amount of plays it takes can be calculated quite simply with. costPerItem/costPerPlay.
If for example I use a Raspberry Pi Add-on that costs £6 and gross margin of 40% (A quite common average) this equals £10 So I'd need £10 for every prize win.
This calculates as one win every 50 Plays at 20p per play (or realistically one in ever 10 people at an average of £1 a person). However having it one in every 50 wins is a bit too obvious.
So how to make it random and look good while meating our requirements?
First off I created a simple python script which simply generates a random number for the claw's electromagnet strength. If it was above 0.65 it was counted as a win and if it was below it was counted as a loss.
Then with a calculation of 300 People a week for our simulation at £1 a person (5 Games) It would calculate as 1500 games. Of which we would get in £300 and would cost £180 in prizes.
Now I'd ideally like to use Machine Learning / Vision to program this but to be honest I'm not even sure if its a possible application for it.
The theoretical idea is that the system to begin with is fed in training data which would be the strength of the claw used and weather the player had won. The idea would then be that the system is then smart enough to generate numbers of strength based on weather it is set to win or loose.