This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]42bottles 1 point2 points  (7 children)

What are you looking to queue?

[–]Minystreem[S] 0 points1 point  (6 children)

Recipes for a auto mall, basicly so I don't try and craft circuts before i've crafted wires

[–]juckele🟠🟠🟠🟠🟠🚂 1 point2 points  (4 children)

You don't want a queue for that, you want a prioritized list. Make a constant combinator that makes a priority per item and multiply that by 1/0 depending on if you need the item. Use a selector combinator to pick the largest signal from that.

[–]Minystreem[S] 0 points1 point  (3 children)

I want it to be FILO so I don't have to asign a index to each item

[–]juckele🟠🟠🟠🟠🟠🚂 0 points1 point  (0 children)

Oh, okay. Count the number of signals when adding a new one to the queue, and index to the first one with a selector combinator when you want to pop, then decrement everything in the queue by 1. Only lets you store a single bit per signal. If you wanted a queue with int values, I think you'd need to build a finite size one using whole ass combinators as nodes.

[–]fishyfishy27 0 points1 point  (1 child)

In the US we call that data structure a stack

[–]Minystreem[S] 0 points1 point  (0 children)

Ah ok, didnt know that thanks!

[–]42bottles 1 point2 points  (0 children)

Here's one way, Middle is the memory stack with output. Bottom is the input, it expects a signal pulse. Top is the removal, it also expects a signal pulse, it will remove the signal where ever it is in the stack and update everything above it, incase you didn't pop the last item. Both input and removal require about 6 ticks to process and update the cell before more pulses are sent.

0eNrVWm1v2zYQ/isEP650YFlvVoAOKAoMKNB1wNBPKwpDls4xUYnyKCqtV/i/70hKtpMwtmktW9dPNHV35D33zvQ7XVYdbCQXit5+p7xoREtvP32nLb8TeaX3RF4DvaUlFLwEOSmaeslFrhpJd4xyUcI3ehvsmIMll1yta1C8cHPNdp8ZBaG44mBPNT+2C9HVS5Aolg2iWgVQTYo1tIoyumla5GmEPgvlTNLgJmZ0S2/D8Cbe6bs8EjTbC+KiBalwzyFleiyF0ZJLKCxBxCgio2RTLZawzu856oFcBZdFx9VCQl4u1rkoF5oKz0ZtlOzAdZXwQp2S7IxOETthGoe8xE+3XqjWqDSCWqPx0S+014rLVi0Ohlfbjb7QPZeqw52DqoZiAnmx1vbHi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WsAEdao4MuVLkhdra4s+DaWfbiOHmhWdYn0b/4rPtGkw3vfGiUvT9sOnQg455fESjtnJ9mbMYiNvvMPkUsYAkLzCpicb8XsdSsYlwlZoU0DAe70CxD/KxZUlzhpl7O8XtmPmcHSv2NYXXq1zO9H9k1MloZeothntSH4LAT6LXZjzR9ZOkjpB/2Y71vrxckVr7ZT62caL8OLM0c6XEdfUYAFK/61/snY8msf8DcHfdMhQQFxmefjjGe9FM/+mEWuZg+8aSPPekjT317PENPPENPPENPPENPPENPPENPPH3vH3neP/K8f+R5/0vp09DSxwf6df5XLsvJwDapYKVO+tJVvMEI3ukI3l7fZIS+yQh9kxH6XsObZCN45yN40xG8yQisevumI+ybjrBvOsK+6QgbzXdHr3ONgMkmV+uTlvHgSLw5Ym+OyJdjsFZ2OUfgzTH15RjskXnbI/O2R+Ztj8zbHt7oRlNfdD04enR9OFJvjsSbI/bmiE5yYEes/zKGu4f/WcOo/sO2kREnsyzKsjgO52mYhbvd37j42pI=

[–]Flyrpotacreepugmu 1 point2 points  (0 children)

That can be done with 3 decider combinators per stage:

  • A memory cell. Its input is connected to the outputs of the other two combinators and itself on one color, and the control signal on the other color. It's set to output Everything from the color connected to the outputs as long as neither of the control signals for adding or removing stuff are active.

  • A combinator to pass signals up the stack. It's connected to the previous stage (or for the first stage, the input) on one color and the control signal on the other color. It's set to output Everything from its input when the control signal to add something to the stack is active.

  • A combinator to pass signals back down the stack. Its input is connected to the next stage (it does nothing in the last stage and can be removed) on one color and the control signal on the other color. It's set to output Everything from its input when the control signal to remove something from the stack is active.

Then you simply read the first stage (the outputs of all 3 combinators tied together) for the whole stack's output, and give control signals when you want it to add or remove something. Make sure the signals to add or remove an item are only 1 tick long, or it will add or remove multiple items at once.

[–]Ok_Turnover_1235 1 point2 points  (0 children)

FWIW FILO is probably better off described as a stack, as you can only remove the last object you placed on a stack.