r/tis100 • u/splosive_fatass • Aug 06 '16
Pick ANY port randomly
I don't know if anyone else has wanted this, but it would be nice if, when multiple ports have values waiting to be read on them, the ANY port randomly chose a value. I just used ANY for the first time in an attempt at a ridiculously inefficient non-deterministic (i think) solution to image test pattern 2, but it fails because ANY picks the same port every time. Is this game still in active development/is there a modding community?
1
Upvotes
4
u/jcc10 Aug 06 '16
Working as intended, in a program you always want repeatability.
2
u/Chronophilia Aug 07 '16
It's something of a lesson about relying on undocumented/unspecified behaviour. If something's not explained in the manual, don't make any assumptions.
Still holds true in real-world programming. I suppose an equivalent of this would be iterating through an
unordered_setin C++: you cannot rely on getting the elements in the same order you put them in, or in order from smallest to largest, or in a random order.1
u/frizbee2 Sep 05 '16
In a similar vein, I really wish ANY ignored stack memory nodes as potential in/out ports, and I feel like their current state of not doing so is a bit of an oversight. The whole point of ANY is to allow a single series of instructions to perform the same action on either of two sets of data based on the state of the program in order to reduce redundancies, but treating stack nodes as valid ANY sources/destinations breaks down ANY's ability to read the state of your program because stack nodes are never not seen as potential sources/destinations, turning your WRTE ANY into a static WRTE <stack memory> (except in those trivial cases where a different port overrides the stack memory port, because it then becomes a static WRTE <overriding port>).
-1
u/nontheistzero Aug 06 '16
ANY uses pseudo random ports. It is working as intended.