Making a Calculator using ONLY MARBLES

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys so today we're gonna be making a marble calculator why though you speak when spoken to Jesus sorry where were we right marble calculators this video actually turned out to be much more educational than I first intended so get ready to learn some [ __ ] - the goal is to make a calculator that which can add two numbers using only marbles and physics and stuff so to build the world's least efficient calculator first we are going to need to know how a normal calculator work and before we can do that we're going to need to learn how binary works ah bloody hell okay let's begin refinery binary is just the encoding of numbers when you can only use once and zeros this is 0 1 2 3 4 5 6 7 8 9 10 11 12 13 right you figured it out yet no fantastic okay moving on so in actual calculators and computers and [ __ ] of one is represented by electricity going to a wire and a zero is no electricity passed through that wire all right making progress if you wanted to represent the number 5 which is 1 0 1 you would have 3 wires with electricity running through the first and last wire simple enough now let's talk marbles instead of a 1 being represented by electricity going through a wire we have a marble going down a tube or laying or whatever this is 5 is 8 this is 2 this is 0 this is 12 you get it all right let's run the calculator Wow wasn't that fun ok the problem is we need the lanes to interact with each other to do this we need to use what is known as logic gates these gates dictate what happens when two lanes collide so the first one I want to look at is the and gate so all logic gates have inputs and outputs four and gates the output will be one if both the inputs are one alright let's label this we got inputs a and B and output C if a and B are 1 and then C is 1 you get it it's an and gate boom logic done knowledge all right simple enough let's bring it back to marbles and an gate needs to output a marble if it receives marble in both inputs so here is my version of an and gate well this is my first attempt anyway so the first marble to come down will fill the little hole and then the second one roll over it and continue down thus the gate is outputting a 1 only when there are marbles going down both lanes however the solution wasn't very robust there sometimes the first marble was able to jump over the hole and also it wasn't quite ridiculous enough for this project so here is and gate to point oh what a beauty so the model in top lane can't goats until the marble and the bottom legs knocked out another marble holding up the barrier preventing the top marble from getting through hell yeah moving on next logic gate we have is an or gate this should produce a marble if either of the input lanes have a marble if a or B is 1 then C is 1 so he or she is this one's pretty simple just if either lanes have a marble and or not the marble down and thus the output will be 1 fairly nice next up is a not gate which is outputs the opposite of the input wait a second these gates dictate what happens when two lanes collide you lied to me yeah ok the gate only Christ one lane I'm sorry please don't go oh well where was I yes not gates this one was actually really hard to implement because if nothing comes down the lane then you're supposed to release a marble so I had a timer which waits for a certain amount of time if nothing has come through once the timer is up then it will release a marble do it wait I'll just show you here it is okay so we got a marble already in the gate slowly approaching the exit if marble comes through the input then the output will be blocked if nothing comes through then the marble in the starting gate will reach the output therefore if the input is 1 in the upload 0 and if the input is 0 then the output is 1 it's a not gate baby dawn now we have an Gates or gates and not gates so using this we can build a calculator sort of we actually need a few more things but we're getting really close these things are much less important they just kind of make things easier sometimes you need to duplicate a lane into two lanes so I made what I called a duplicate one goes in two goes out it's a simple stuff also because most of this is gravity based you lose altitude quick so I added an elevator which releases a ball above it and with that we can finally do this so how does addition in binary actually work well let's just look at adding single digit binary numbers so if both a and B are 0 then a plus B is also 0 if a is 1 and B is 0 then a plus B is 1 same with 0 plus 1 if both a and B are 1 then a plus B is 2 but we can't have to wait [ __ ] everyone panic now actually can just carry the 1 oh sorry so our adder needs to take in two inputs a and B and produce two outputs 1 which is the sum and 1 which is the carry so if a and B are 1 then the output would be 0 carry 1 ok so enough teasing here is the adder let's put it those tests 1 plus 0 course oh it's done it so adding zeros and ones and stuff is fantastic and all but we want to add bigger numbers to make it an actual calculator best way to explain this is just to do some math just normal everyday math with big numbers in it like - so let's add 582 plus 946 this is pretty hard to do on your head so we developed a method for doing sums first you look at the rightmost digits then you add them so 2 plus 6 is 8 let me look at the digits 1 to the left and repeat 4 plus 8 is 12 per car right 12 so we're at 2 and carry the 1 and it's 5 plus 9 plus the one we carried which is 15 then we write down the 5 carry the 1 and the 1 is the only number in the fourth digit line so we just write down the 1 Wow okay I didn't think I'd be doing prime school level math but it will be relevant I swear I know your attention spans can't handle this so he's a picture of a pug now it's so bloody cute ok moving on now let's do it with binary numbers I would do the same numbers but this is 946 in binary so let's do some smaller numbers like 7 plus 5 so we do it exactly the same as the previous example to first go to the rightmost digits then do we do 1 plus 1 which is 2 or 1 0 in binary so we write down a 0 and carry the 1 next is 1 plus 1 again so we write down the zero carry the 1 next 1 is 1 plus 1 plus 1 which was carried which is 3 & 1 1 in binary so write down the one carry the 1 which just gets written down as 1 so we get 1 1 0 0 which is 12 which is 5 plus 7 okay so we need to implement this method of addition using only marbles huh why am I doing this again also if you notice doing the addition things sometimes you need to add 3 numbers one from the first number one from the second number and also a carried number it's hard to add three numbers using our adder which get on the add two numbers and one which can add three is much more complicated because of course it is we can do it with the gates we've already implemented but it's a little easier if we introduce a new guy and you know how each of the gates had names which were very intuitive like ended or not well introducing the XOR gate these outputs are 1 if either input is 1 but not if both inputs are 1 so if a or b but not a and b so he or she is it's just one of the inputs comes down then it'll knock the ball which will slowly reach the exit but if both come down then they'll block off the exit okay XOR gate done we are ready finally so this is the full adder which can add three binary numbers let's try one plus one plus one [Music] yeah nice now we're talking so now our full calculator will consist of three adders meaning it can add three digit binary numbers I could make it bigger but yeah no that's not happening let's start with the example we used before which is seven plus five so seven is 1 1 1 5 is 1 0 1 all right let's do it [Music] [Music] you ready oh that's 12 baby we got it we got it what's next I'm not creative enough to think of numbers we got what's that three plus six three plus six what you got [Music] whoo it's happening yes one 0:09 coming up yeah touchdown bloody marvel calculate you have no idea how much effort this took also if you want to test out this calculator yourself link will be in the description you just play it in your browser I don't know why you would want to use it it's awful and works about 60 percent of the time but ya know have fun I suppose if you're into excruciating ly slow calculators that don't work all the time and can only add numbers up to seven then go for your life do I have the products for you uh I'm sorry this video took ages to make mainly because first of all I'm a uni second of all I was trying to build a Marvel bloody calculator and that takes its time so yeah sorry so this one took a while it was a lot more art than it was science which is you know you've seen my ability at art and so yeah live and learn but I am back at uni now so I won't be able to make as many videos I would still be making videos don't you worry still got awesome plans to come or some players to come though you say awesome things to come that I'm planning yeah that'll do um so bye yeah see ya [Music]
Info
Channel: Code Bullet
Views: 2,796,401
Rating: undefined out of 5
Keywords: artificial, intelligence, coding, processing, java, machine, learning, genetic, algorithm, evolution, computer, science, programming, comedy, educational, calculator, math, binary, marble run, marbles, logic gates, logic
Id: i1e0T7lAELQ
Channel Id: undefined
Length: 11min 45sec (705 seconds)
Published: Thu Aug 09 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.