DicemanX
Brain of Cthulhu
I present yet another advanced hoiktronics build: a fully automated slot machine! The slot machine has a bank system that keeps track of your money. Each time you pull the slot lever it deducts $1 from your account, and every time you win it adds to your tally. Here's a video of the slot machine in action, followed by a more in-depth tutorial of the mechanisms involved. In this post I'll summarize the logic of the entire mechanism and present the schematics of the build.
Video:
Picture of the Slot Machine:
Wiring:
How the slot machine Works:
When you first enter the machine, $21 is automatically added to the bank. You use money to play - it costs $1 to pull the lever. Each time the lever is pulled, $1 is deducted from the total automatically. A single pull of the lever randomizes the symbols that appear in each of the three slots. There are three possible symbols - a diamond, a spade, and a seven. The payouts for getting three symbols in a row are as follows:
3x Diamond = win $10
3x Spade = win $20
3x Seven = win $20
The winnings are added to the total automatically. Once the player reaches $100 or more (thus winning the game), a secret door opens, granting access to a treasure chest filled with rare items.
Exiting from the slot machine triggers a reset mechanism which wipes the bank total. Re-entering automatically puts $21 into the bank.
Explanation of Mechanism:
The slot machine consists of three components:
1) Randomizer System (cause random symbols to appear in the three slots each time a lever is pulled)
2) State Readers (check to see if 3 identical symbols appear in each of the slots)
3) Count-up and Countdown seven segment displays (keep track of bank totals)
The randomizer system is constructed by chaining a number of randomizer units together. Here`s a schematic of each unit:
The summoned skeleton can take 1 of two paths when it reaches the first door on the left. If the door is closed, then it acts as a solid wall and the skeleton will end up being hoiked further to the right, hitting the pressure plate connected by green wire to an output (right torch in the diagram). If the door is open, then the skeleton ends up getting hoiked upwards and then to the left, hitting the pressure plate connected by green wire to a different output (left torch in the diagram).
When closed doors are activated by wire, they have a 50% chance of opening to the left and 50% chance of opening to the right, so long as there's room. This is why a second door, the door on the right in the diagram, needs to be used in the mechanism. When that door is activated, if it opens to the left, it stops the left door from opening and results in the skeleton passing through the bottom pressure plate. If however the right door opens to the right, the left door is allowed to open and the skeleton passes through the upper pressure plate instead.
In the Slot Machine, each slot has two such randomizers chained together, resulting in 3 possible outputs. The outputs are connected to the slot display and light up torches to form either the diamond, spade, or seven symbols. A skeleton that passes through the first randomizer triggers via an early pressure plate a skeleton to pass through the next randomizer, until the randomly-generated symbols appear in all three slots.
The next stage after randomization is the activation of the state checkers (the final randomizer in the chain has a pressure plate that is connected to skeletons in the state readers). State checkers check the state of a system, and generate outputs if a certain state is detected. Here's what they look like in the slot machine:
The red wire on the far left is from the last randomizer, and spawns skeletons in all three rows. The skeletons pass through the ghost walls (actuated hoik teeth next to a solid wall makes it possible to pass through that wall) and trigger the pressure plates that send them through the horizontal hoiks. The skeletons initially take damage from the lava, and can be killed off by any of the three spear traps as they move through the horizontal hoik.
The bottom track represents the default state of the state checker - a skeleton passing through that track, it it were invulnerable, would trigger all three pressure plates (of course in reality it would die at the first one and never make it through the other two). The top track represents a situation in which none of the three pressure plates would be activated. To create this state, signals have to be sent through all three blue wires to toggle the bottom and top hoiks that control whether the pressure plates to the right of those hoiks will be activated.
In other words, if the same symbol appears in all three slots then the skeleton will successfully pass through one of those three tracks and reach the pressure plate at the far right. That pressure plate is connected to the counter mechanism, which will add 10 or 20 to the bank total, depending on which three symbols are matching in the three slots.
The counter mechanism will be explained in more detail in a separate thread, due to its complexity. The video goes into some detail regarding the mechanism, and the tutorial world is available for download below if you want to see the mechanism first hand and play around with it.
Update:
I added two new mechanisms to the slot machine. The first is a XOR gate that disables the lever when the counting mechanisms are active - without this disabling mechanism if the lever was pulled twice in quick succession then it messed up the counting mechanisms. Here's are the updated pics of the relevant region:
Wiring:
The two XOR gates are to the left - here's a closer look:
The sequence of events is now as follows:
When the slot machine lever is pulled, it spawns a skeleton in the top left XOR gate (referring to the close-up pic directly above). That skeleton will be hoiked down into the lava by the second down hoik tooth or by the third down hoik tooth. In the lava are pressure plates that connect to the next XOR gate to continue the chain of events. There are also actuated blocks beolow each of those down hoik teeth. If there is a 0 in the tens position of the dollar amount in the bank, the left actuated block becomes deactuated (via the incoming green wire on the left of that XOR gate), preventing the skeleton from being hoiked downwards at the second hoik tooth. If there is a 0 at the ones position of the dollar amount in the bank, then the right actuated block becomes deactuated (via the incoming green wire on the right of that XOR gate), blocking the skeleton from being hoiked downwards at the third hoik tooth. In other words, if there is $00 in the bank the skeleton is prevented from reaching the pressure plates in the lava, and the chain of events is severed at this point.
If the dollar amount is greater than $00, then the chain of events isn't severed. When the skeleton reaches either of the pressure plates in the lava of the first XOR gate, it spawns a skeleton in the second XOR gate to the bottom right corner of the close-up pic above. The skeleton needs to pass straight through to the two pressure plates on the right and into the lava + spiky ball trap where the blue wire and green wire connect. Those two pressure plates initiate the deduction of $1 from the bank total, and trigger the spawning of the skeleton in the reset hoik track which will then trigger the randomizers as described earlier in this post.
When the NPCs are busy adding to or deducting from the bank total, the blocks below the hoik teeth in this second XOR gate become actuated, and the skeleton is hoiked downward into the lava and spiky balls below. This prevents the skeleton from ever reaching the far right until the addition/subtraction operations are completed.
World Download:
http://www43.zippyshare.com/v/6JBOnLVK/file.html (old link)
http://www77.zippyshare.com/v/YlLi8lnN/file.html (updated link)
(Enter B0 in the Teleporter Hub to reach the Slot Machine)
Tutorial World:
http://www64.zippyshare.com/v/5sYcbUsL/file.html (old link)
http://www44.zippyshare.com/v/SmMaiQih/file.html (updated link)
(use the left teleporter at spawn point)
Video:
Picture of the Slot Machine:
Wiring:
How the slot machine Works:
When you first enter the machine, $21 is automatically added to the bank. You use money to play - it costs $1 to pull the lever. Each time the lever is pulled, $1 is deducted from the total automatically. A single pull of the lever randomizes the symbols that appear in each of the three slots. There are three possible symbols - a diamond, a spade, and a seven. The payouts for getting three symbols in a row are as follows:
3x Diamond = win $10
3x Spade = win $20
3x Seven = win $20
The winnings are added to the total automatically. Once the player reaches $100 or more (thus winning the game), a secret door opens, granting access to a treasure chest filled with rare items.
Exiting from the slot machine triggers a reset mechanism which wipes the bank total. Re-entering automatically puts $21 into the bank.
Explanation of Mechanism:
The slot machine consists of three components:
1) Randomizer System (cause random symbols to appear in the three slots each time a lever is pulled)
2) State Readers (check to see if 3 identical symbols appear in each of the slots)
3) Count-up and Countdown seven segment displays (keep track of bank totals)
The randomizer system is constructed by chaining a number of randomizer units together. Here`s a schematic of each unit:
The summoned skeleton can take 1 of two paths when it reaches the first door on the left. If the door is closed, then it acts as a solid wall and the skeleton will end up being hoiked further to the right, hitting the pressure plate connected by green wire to an output (right torch in the diagram). If the door is open, then the skeleton ends up getting hoiked upwards and then to the left, hitting the pressure plate connected by green wire to a different output (left torch in the diagram).
When closed doors are activated by wire, they have a 50% chance of opening to the left and 50% chance of opening to the right, so long as there's room. This is why a second door, the door on the right in the diagram, needs to be used in the mechanism. When that door is activated, if it opens to the left, it stops the left door from opening and results in the skeleton passing through the bottom pressure plate. If however the right door opens to the right, the left door is allowed to open and the skeleton passes through the upper pressure plate instead.
In the Slot Machine, each slot has two such randomizers chained together, resulting in 3 possible outputs. The outputs are connected to the slot display and light up torches to form either the diamond, spade, or seven symbols. A skeleton that passes through the first randomizer triggers via an early pressure plate a skeleton to pass through the next randomizer, until the randomly-generated symbols appear in all three slots.
The next stage after randomization is the activation of the state checkers (the final randomizer in the chain has a pressure plate that is connected to skeletons in the state readers). State checkers check the state of a system, and generate outputs if a certain state is detected. Here's what they look like in the slot machine:
The red wire on the far left is from the last randomizer, and spawns skeletons in all three rows. The skeletons pass through the ghost walls (actuated hoik teeth next to a solid wall makes it possible to pass through that wall) and trigger the pressure plates that send them through the horizontal hoiks. The skeletons initially take damage from the lava, and can be killed off by any of the three spear traps as they move through the horizontal hoik.
The bottom track represents the default state of the state checker - a skeleton passing through that track, it it were invulnerable, would trigger all three pressure plates (of course in reality it would die at the first one and never make it through the other two). The top track represents a situation in which none of the three pressure plates would be activated. To create this state, signals have to be sent through all three blue wires to toggle the bottom and top hoiks that control whether the pressure plates to the right of those hoiks will be activated.
In other words, if the same symbol appears in all three slots then the skeleton will successfully pass through one of those three tracks and reach the pressure plate at the far right. That pressure plate is connected to the counter mechanism, which will add 10 or 20 to the bank total, depending on which three symbols are matching in the three slots.
The counter mechanism will be explained in more detail in a separate thread, due to its complexity. The video goes into some detail regarding the mechanism, and the tutorial world is available for download below if you want to see the mechanism first hand and play around with it.
Update:
I added two new mechanisms to the slot machine. The first is a XOR gate that disables the lever when the counting mechanisms are active - without this disabling mechanism if the lever was pulled twice in quick succession then it messed up the counting mechanisms. Here's are the updated pics of the relevant region:
Wiring:
The two XOR gates are to the left - here's a closer look:
The sequence of events is now as follows:
When the slot machine lever is pulled, it spawns a skeleton in the top left XOR gate (referring to the close-up pic directly above). That skeleton will be hoiked down into the lava by the second down hoik tooth or by the third down hoik tooth. In the lava are pressure plates that connect to the next XOR gate to continue the chain of events. There are also actuated blocks beolow each of those down hoik teeth. If there is a 0 in the tens position of the dollar amount in the bank, the left actuated block becomes deactuated (via the incoming green wire on the left of that XOR gate), preventing the skeleton from being hoiked downwards at the second hoik tooth. If there is a 0 at the ones position of the dollar amount in the bank, then the right actuated block becomes deactuated (via the incoming green wire on the right of that XOR gate), blocking the skeleton from being hoiked downwards at the third hoik tooth. In other words, if there is $00 in the bank the skeleton is prevented from reaching the pressure plates in the lava, and the chain of events is severed at this point.
If the dollar amount is greater than $00, then the chain of events isn't severed. When the skeleton reaches either of the pressure plates in the lava of the first XOR gate, it spawns a skeleton in the second XOR gate to the bottom right corner of the close-up pic above. The skeleton needs to pass straight through to the two pressure plates on the right and into the lava + spiky ball trap where the blue wire and green wire connect. Those two pressure plates initiate the deduction of $1 from the bank total, and trigger the spawning of the skeleton in the reset hoik track which will then trigger the randomizers as described earlier in this post.
When the NPCs are busy adding to or deducting from the bank total, the blocks below the hoik teeth in this second XOR gate become actuated, and the skeleton is hoiked downward into the lava and spiky balls below. This prevents the skeleton from ever reaching the far right until the addition/subtraction operations are completed.
World Download:
http://www43.zippyshare.com/v/6JBOnLVK/file.html (old link)
http://www77.zippyshare.com/v/YlLi8lnN/file.html (updated link)
(Enter B0 in the Teleporter Hub to reach the Slot Machine)
Tutorial World:
http://www64.zippyshare.com/v/5sYcbUsL/file.html (old link)
http://www44.zippyshare.com/v/SmMaiQih/file.html (updated link)
(use the left teleporter at spawn point)
Last edited: