Turing Tumble Community

Build a Voting Machine

Challenge: build a Voting Machine: Three bits are set, each to the left or right, indicating three independent votes. After one lever is pressed (and perhaps other balls triggered), somehow on the board it is indicated whether the majority are for the left party, or the right party. Extra points if one or more of the following are satisfied:

  • After your machine is run, the original votes can still be seen (in case a recount is needed). This might make it more cumbersome though.
  • Your solution can fit on the physical board with the supplied parts.
  • Only one ball is needed.
  • Your machine is ready before November 6, and can’t be hacked by foreign agents. :slight_smile:

Edit - I don’t think this is too hard, though it did take me several iterations to get something that would both nondestructively read the votes, and fit on the original board. (I originally had two different solutions, each with only one of those features.) It uses just one ball.

Here is my attempt:
https://www.lodev.org/jstumble/?board=bebgbfxfegbgbgfbbbfxxflbreerbgbleerxlfiife

It fits on a board, uses a single ball, and reads the votes non-destructively. However, it does use more parts than are standard included in the box. The standard box only contains eight purple gears and four red gears, whereas my solution requires respectively eleven and five.

As far as I know, non-destructive reading of a bit using a single ball requires at least three purple gears, so I find it hard to imagine a solution that non-destructively reads three bits using less than nine purple gears. Or am I overlooking something?

Ooops - you didn’t miss anything. I would also be surprised to see three nondestructive writes with fewer than nine gear bits. My solution fit on the board, but, like yours, used more parts. Actually, my solution is identical to yours in all respects, but saves one red gear in the middle row. Perhaps the challenge now is whether this can be done with fewer than 11 gear bits… and, as few as 9.

Ok - turns out you only need two gear bits for a nondestructive write. Here is a solution using only 8 gear bits. But, it uses seven gears, and doesn’t quite (yet?) fit on the standard board. Oh well. (Note the middle two gears could be moved closer together if we had that “reflector” piece. This would save a couple gears.)

Edit: (sorry - I keep I keep thinking of improvements). Here is a solution using only parts that come with the game (eight gear bits, four gears), reads non-destructively, and needs only one more row to fit on the board. The caveat is that you need to set four bits. The middle two, which are no longer linked together, need to be set the same at the beginning, reflecting the second vote.

New challenge: How about a vote of four (break ties in favor of left), or even of five??

If you don’t care about the recount, than I have an extendable solution. This is for 9 voters.

https://www.lodev.org/jstumble/?board=ree0fagafellrfeeagagagafflrrlrffeagagagagagaffelrllrlrffagagagagagagagafeerelrrlrllfeeragagagagagalffrrllrllfferagagagalffeerrlllzragalzer0lzeerlzfxzfiizzzzzzzzzzzfee&w=27&h=21

EDIT: I don’t think foreign agents would be able to get inside my house, but I’d have to keep a watchful eye on my parents.

Looks like we’re thinking along the same lines. If you do care about the recount, here are solutions for four, five, and six voters. For the even numbers, ties are indicated. Extensions to larger numbers of voters is natural. Both your solution, and mine, look like the natural way to do things - and is reminiscent of Pascal’s triangle, or more accurately, perhaps a lattice keeping track of the difference between L and R.

Here’s my solution for five votes, which still fits on a normal board:
https://www.lodev.org/jstumble/?board=1ebgbeerrrfagagaeerrrreeragaleer0lfrlfexfeiif
Like the solution by donutcomputer, reading is destructive. My solution uses slightly fewer gears, but the downside is that it’s not symmetrical around the vertical axis and less pretty as a result.

Ah, yes, two gear bits suffice indeed. However, at the expense of an extra row, which on a normal board can be a significant drawback.

The lack of a “reflector” piece is indeed a shame. There are quite a few cases where it enables a more compact design.

Disconnecting the middle vote in your second solution feels a bit like cheating…

Nice. It looks like all of these are doing the same thing, which, when you think about it, seems to be all one can do - keep track of the difference between left and right votes as you go down. The most compact form of this is the following:bit%20pyramid.
If we assume all bits on the same level are set the same (I guess the Nth voter needs to set N bits), then the N+1 exit points indicates one of the N+1 possible vote tallies (N,0), (N-1,1), (N-2,2), …(1, N-1), (0,N).

Yes - I agree disconnecting the gears is cheating. But I think this picture helps us see what is going on, without the gears forcing us to skip rows. The need to avoid adjacent rows of gears is requiring either a skew, as in your solution, or as in that of @donutcomputer , unless you want to skip two rows, you end up with each row increasing by two gears, which doesn’t quite seem necessary.

Have we beat this one to death yet? I’m out of ideas.

OK - here is another challenge along these lines.: All voters vote “at the same time” - so their vote bits are at the same level. For example, in this starter project the three votes are the three blue bits. Press the blue lever once, and (perhaps after extra balls are triggered) stop the balls, and indicate the winner somehow.

If you’d like, you can start with the blue bits elsewhere, but all have to be on the same level, and all are regular bits, not gear bits. Extra points for fitting on the standard board, or for handling more voters, or for giving a general scheme…(my solution does none of these at the moment.)

After a bit of play, I came across what I think is a very aesthetic solution to the voting problem when all vote bits are at the same level. The strategy uses a binary tree to iteratively route the ball through each vote, and then record each vote by adding or decrementing a counter, as we saw in another puzzle. You might enjoy solving this one yourself, but if you don’t want to, here is the solution for seven voters.

The votes are the row of bits level with the interceptor. After the run, the bottommost gear bits point to the winning side. Actually, the counter bits represent the value (left votes minus right votes), and when this number is negative, it is causes underflow, which results in the high order bit pointing to the right - a lucky coincidence. If one wants to keep track of separate tallys of votes that is easy enough by removing the gears and flipping some ramps to make the bottom unit two separate counters.

I found a solution for 5 votes all in the middle. To make it work though, I had to make it so that the votes were ‘switched’ where it points to the opposite side it votes on. It uses only the pieces and space available in the box, and uses one ball.

I also believe I have made it hacker-free :slight_smile:

https://jessecrossen.github.io/ttsim/#s=13,17&z=64&cc=6&cr=8&t=3&sp=1&sc=0&b=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAASCAYAAACAa1QyAAAAAXNSR0IArs4c6QAAAQRJREFUOE+VkzFuwzAMRT+Xzhk7SmfIAWz0JDbce0g5iAH7HkGhsVOQG0hzhhwhLKSChiNxSAgIkgg+fPBLpBDCYxgG5LUsC/q+RwgBEnXeew8SKBfFmGCt2QA5zHPCNP3nFSgSAWAA1lqOMd8JDC73BioFRGBmSKEoST6Dm1LXdVngKUSxzq/ryqWnGqIfAn8xZN+DKnQiwIFwAsOVLp6jgaSXen9PSVF8WWnvptqTFNS9iSkvu7d3sUDe+0ftkHNu+xnjODYekjGmgWKKsMZiTjMmMzW2N9D+V7evhDINqpKAGpTHR4VycQa1yPNGAPO3OeJyuIM/gOPtgPPnFelXZUryD0460LAN6CrnAAAAAElFTkSuQmCC