If one race should win the game, set racesToWin = 1; - in line 46.
Since I did not have a pin ball machine at hand, I 'invented' and integrated this reaction game with the flickering. With this game all players play at the same time for each game step. No turns have to be taken by the players.
For a pinball machine, this looks different: 1 player plays at 1 time and players take turns. Is that assumption correct?
If this assumption is correct, game control has to be bit different. To have a clear game control / flow, the player's turn has to be shown on the board.
You can take this code and modify it. First, you have to rip out the flicker stuff and the too early and just right functions. Game control has to trigger the indication which players turn it is and just enable 3 pins to read the roll over switches or whiskers - like I used the 2 reaction buttons. Two springy wires are good enough for one whisker switch: one wire is connected to ground and the other to the pin, and when the metal ball runs 'between' them is a momentary switch. If you have a rollover switch, that works as well.
For programming just think of the lights as memory entities: 3 bytes reflect one position, and since they are daisy chained, it is just pushing the memory into the sting. One Espruino should be good for quite many positions. It all depends how many players or lanes (horses) you want, and how many steps or positions the race should have.
To understand the pinball machine part a bit better, you may need to describe a bit more what is going on in it.
From the initial description it looked like that you only count where the ball exits: path 1, 2, or 3, and each of these give that many points or advance the player so many steps on the board: 1, 2, 3.
If the machine works more like a pin ball machine where the ball can bounce like crazy between positions and each bounce advances the horse on the board, then it may look a bit different. The cool part would be multiple pin ball machines so players can play simultaneously...
Exactly, players are simultaneously playing.
So, the handle is pulled and shoots the ball up, it bounces on rubber bumpers but the bumpers do nothing.
Think of them like the bumper rails on a pool table.
Gravity takes over and the ball drops into one of two lanes. One lane has two rollover switches, the other lane has three.
The ball rolls over each switch and the light advances.
Since the lights are programmable, (remember I really don't know much about all this so if it sounds dumb, sorry) couldn't one switch be used to advance the lights two or three lights depending on which of 2 switchs is activated instead of using 5 switches?
As the lights advance, they reach the "Final Stretch".
Question, can the lights in the final stretch be programmed to advance one light using the same switches instead of two or three lights? Basically slowing down the leaders so others can catch up?
Do I need to cut the string (or can I cut it?) or is it one long string zig zagging back and forth?
It seems to me that the lights then have to be coded backwards for every other player. Is it more efficient to cut the string, add three lengths of long wire to start the string for those players at the start instead of backwards coding them? It seems simpler for the coding? Am I perceiving this correctly?
Next question: after enlarging the picture of the board, I discovered there are 30 lights for each player to light. 24 lights during the race and then six lights for the Final Stretch.
If I reproduce the game exactly like the picture, there are 18 players. I'm reproducing something that no longer exists. I may donate this to an arcade museum after I leave this world, that means all 18 players for a faithful reproduction. How much power will this take?
Can the Espruino handle that many players?
If not, what is the number of players that can play on one board and what power supply should I purchase to run all of it?
Can I use a power supply like those used for a pc upgrade with a powerful graphics card. I think this is a compatible solution but I'm guesstimating here.
Do you have a way I can call or you can call me. I think verbally communicating might help on the game operation. Everything for the coding and building should stay here on the forum.
As I'm on my cell, I can't see the pictures Robin posted. My eyes are old and its hard to watch them. The pc at home is much easier to see.
I may add more comments this afternoon when I get home. A real keyboard and big screen.
© Espruino, powered by microcosm.
Report a problem