-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduced randomness #20
Reduced randomness #20
Conversation
d414186
to
e67aef5
Compare
This pull request is confusing me a bit and yeah should probably be split up into smaller pulls. It also seems to introduce a few bugs which is less than ideal.
Anyways, thanks for the pull request! I definitely like some of the ideas in here :) |
Thanks for the feedback. I didn't modify the README at all, because I didn't know if there was interest in the changes, but I should have mentioned that.
|
7542784
to
cae7e2e
Compare
|
cae7e2e
to
8d4b46a
Compare
LGTM (didn't test) for almost all except the cfa757e (the second commit), I think it should be an option like I think pipes.sh has gone a long way, although I am not entirely sure if this:
is what I want to see, but it's become more complex for sure. (and overly complicated for me) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a nitpick on the randomness which isn't uniform.
pipes.sh
Outdated
@@ -117,7 +122,7 @@ while REPLY=; read -t 0.0$((1000/f)) -n 1 2>/dev/null; [[ -z $REPLY ]] ; do | |||
((${l[i]}%2)) && ((x[i]+=-${l[i]}+2,1)) || ((y[i]+=${l[i]}-1)) | |||
|
|||
# Loop on edges (change color on loop): | |||
((!NOEDGECHANGE&&(${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0))) && ((c[i]=RANDOM%8, v[i]=V[${#V[@]}*RANDOM/M])) | |||
((!NOEDGECHANGE&&(${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0))) && ((c[i]=${C[$((RANDOM%${#C[@]}))]}, v[i]=V[${#V[@]}*RANDOM/M])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The outcome isn't uniform, see my post.
It should be like # * RANDOM / M
, but if you don't care, well, it's just a color.
The starting colour isn't actually random at the moment. It's always red. I agree that having the starting colour be random would be nicer. I'm now rethinking this patch set, and I think I can do all this in a simpler more understandable way. Hopefully I can have an update up soon. |
@parkercoates My comment was from the future! Just kidding, my memory was messed up with pipesX.sh. I love simplicity, by the way, I think setting |
This behaves pretty much identically to -t. It sets up a pool of available colours, which are assigned to pipes in order and which is chosen from when randomising.
Previously, initial pipe colours were handed out in a predetermined order. Conversely, initial pipe types were assigned completely at random making no attempt to avoid duplicates. The new behaviour is consistent for both. The colour and type of the first pipe is completely random, but the colour and type values are then cycled through in an orderly fashion. This ensures a random, but evenly spread start, which I think looks pretty nice.
Turning off randomisation allows pipes to retain their "personality" after crossing the edge. Personally, I like this because I can watch, say the different colour pipes fight it out for control of the screen. This also disables the randomisation of the initial pipe colour and type.
8d4b46a
to
40033f4
Compare
Okay, so the changes aren't as substantial as I thought they'd be. The order of the commits makes more sense now, though. I tried to order them from least to most controversial. ;) If there's a feeling that the |
pipes.sh
Outdated
@@ -114,12 +114,12 @@ while REPLY=; read -t 0.0$((1000/f)) -n 1 2>/dev/null; [[ -z $REPLY ]] ; do | |||
((${l[i]}%2)) && ((x[i]+=-${l[i]}+2,1)) || ((y[i]+=${l[i]}-1)) | |||
|
|||
# Loop on edges (change color on loop): | |||
((${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0)) && ((c[i]=RANDOM%8, v[i]=V[${#V[@]}*RANDOM/M])) | |||
((${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0)) && ((c[i]=8*RANDOM/M, v[i]=V[${#V[@]}*RANDOM/M])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is unnecessary, for divisor n == 2^i, that is 32768 % n == 0, the outcome is evenly distributed.
(I was hoping this commit would come separate (from this PR), after coding style fix, and or within refactoring, but it's fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am making this as a change request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert that line.
pipes.sh
Outdated
@@ -114,12 +114,12 @@ while REPLY=; read -t 0.0$((1000/f)) -n 1 2>/dev/null; [[ -z $REPLY ]] ; do | |||
((${l[i]}%2)) && ((x[i]+=-${l[i]}+2,1)) || ((y[i]+=${l[i]}-1)) | |||
|
|||
# Loop on edges (change color on loop): | |||
((${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0)) && ((c[i]=RANDOM%8, v[i]=V[${#V[@]}*RANDOM/M])) | |||
((${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0)) && ((c[i]=8*RANDOM/M, v[i]=V[${#V[@]}*RANDOM/M])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am making this as a change request.
@parkercoates I will merge once you make the change. Off-topic: If you have time, I think you should apply for pipes.sh new maintainer position at pipeseroni/pipeseroni.github.io#3, currently, we have no one to actively maintain pipes.sh. |
@parkercoates I've merged this, if you have more to contribute in the future, please keep PR/commit atomic. |
@livibetter, Thanks for the merge! I'm normally a stickler for atomic review requests, so I doubt this will be an issue in the future. And speaking of the future, thank you for the invitation to become a maintainer, but I think I lack both the qualifications and the motivation. I know very little about all the terminal control stuff and really only wanted to make a handful of changes so that I could watch two differently coloured pipes battling it out to dominate the screen. |
If you are really lack of them, I'd not have asked. Anyway, they are cool pipes! |
@parkercoates I have stolen your idea in that screenshot to make a video. |
A small set of changes, including two new flags to control how pipes are displayed. Could be broken up into smaller pull requests if desired.