Browse Search Popular Register Upload Rules User list Login:
Search:
(LAG) Marble Logic Gates

Image:
screenshot of the scene

Author: Little

Group: Default

Filesize: 67.67 kB

Date added: 2023-06-24

Rating: 5

Downloads: 647

Views: 221

Comments: 8

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Did I do the marble race thing right? Lol.

Jokes aside, this is a pack of (slow and buggy) logic gates that take marbles as inputs and outputs.

Included in the scene are the 7 basic gates (NOT, OR, AND, XOR, NOR, NAND, and XNOR), a "splitter" and "junction" piece, a switch, and a (slow) full adder.

My original plan was to build an entire marble ALU, with subtraction and addition, but just having 2 full adders in the same scene became unbearably laggy.
So this is the best you're gonna get (unless you wanna see Algodoo struggle) unfortunately.

I also want to point out that the output on the full adder is backwards if you want to read it in Binary. 2 would be represented as 01 instead of 10 because I didn't want to use even more junctions.

It's fun to watch the gates go once you give them an input though!


Have fun!

"Some unqualified nerds thought this was cool."
2022 - 2023 XCS & XKS

Feel free to reupload this scene or parts of it with credit to XCS and/or XKS.
Last edited at 2023/06/24 22:27:55 by Little
Please log in to rate this scene
edit
Similar scenes
Title: Logic Gates
Rating: 5
Filesize: 22.31 kB
Downloads: 1076
Comments: 0
Ratings: 1
Date added: 2012/01/28 05:58:03
Made with: Algodoo v2.0.2 Edu
Rating: rated 5
download
Title: Logic Gates
Rating: 6.6
Filesize: 330.92 kB
Downloads: 717
Comments: 3
Ratings: 5
Date added: 2008/08/15 10:26:57
Made with: Phun
Rating: rated 6.6
download
Title: 4 bit adder with logic gates
Rating: 5.625
Filesize: 27.91 kB
Downloads: 1580
Comments: 15
Ratings: 2
Date added: 2023/08/13 22:08:01
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: logic gates
Rating: 5
Filesize: 59.18 kB
Downloads: 942
Comments: 1
Ratings: 1
Date added: 2020/11/22 15:27:05
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Nostalgia - Logic gates
Rating: 5
Filesize: 33.26 kB
Downloads: 1080
Comments: 2
Ratings: 1
Date added: 2021/12/05 21:50:41
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Identity, And logic gates
Rating: 7.4444
Filesize: 50.3 kB
Downloads: 568
Comments: 3
Ratings: 9
Date added: 2008/12/06 02:32:38
Made with: Phun
Rating: rated 7.4
download
Responses to this scene
show list
Title: Logic Gates
Rating: 5
Filesize: 110.55 kB
Downloads: 694
Comments: 4
Ratings: 1
Date added: 2023/06/24 22:09:14
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Laser Hit Count
Rating: 5.625
Filesize: 23.53 kB
Downloads: 4148
Comments: 2
Ratings: 2
Date added: 2023/06/24 15:22:55
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Nice work. Works well at 60 Hz but the logic fails at higher simulation frequency. Kilinich, Xray, and I have all made scenes dealing with detecting when an object is not being hit by a laser (onStopHitByLaser event, onLaserStop event, and onNotHitByLaser). I will add a response scene that counts the number of lasers that hit an object in case that helps.
Deleted a bunch of code in this comment because that code is now in a response scene.
Last edited at 2023/06/24 22:13:27 by s_noonan
I originally tried something similar but the count of lasers kept fluctuating. If I had 2 lasers hitting it, it would say 2 most of the time but sometimes it would say only 1 was hitting it, and it would oscillate while it was on no less.

It was more basic, just being hit by a laser incremented a variable and each tick the gate would retrieve the variable, do the logic, then reset the variable.

Nonetheless, that does seem like a cleaner approach than mine, thanks for the advice!
Last edited at 2023/06/24 22:03:03 by Little
I ran into the same problem so I experimented with the code until I could get it to work at the full range of sim.frequency and simulation speed. I suspect Kilinich's code is efficient and works well, but I had a hard time understanding it.
The reason it does this afaik is because of how Algodoo calculates lasers.

Me and UnityDogGaming04 were doing tests with lasers and, iirc, we discovered that lasers are calculated on a per-frame basis rather than a per-tick basis. Changing the simulation speed or the simulation frequency won't change the lasers.

This is of course from memory and as such it might be wrong, but the point is that lasers are just plain weird!

I wasn't really testing for non-60 frequencies because it was already super laggy at 60hz. It would be even laggier at a higher frequency!
Last edited at 2023/06/24 22:21:30 by Little
The behavior that I recall seeing is that Algodoo may not calculate lasers every frame, but if it checks one laser during a frame it will check them all. Reporting a laser count every frame may report a zero or may report the actual count.

P.S. My new story is that a laser hit is detected once per frame but only if there is at least one tic during the frame period.
Last edited at 2023/06/25 15:34:06 by s_noonan
Either way it's really unintuitive and my 2 am brain (yes, I made this at 2 am) couldn't understand. :bonk:
Last edited at 2023/06/24 22:43:35 by Little
glitchy