Skip to main content

Timeline for The shifting dot

Current License: CC BY-SA 3.0

16 events
when toggle format what by license comment
Oct 5, 2016 at 20:56 history edited Victor Stafusa CC BY-SA 3.0
deleted 1 character in body
Oct 5, 2016 at 20:43 history edited Victor Stafusa CC BY-SA 3.0
-1 char
Oct 5, 2016 at 15:09 comment added Victor Stafusa @KevinCruijssen Well spotted. Thank you.
Oct 5, 2016 at 15:09 history edited Victor Stafusa CC BY-SA 3.0
6 chars less
Oct 5, 2016 at 7:27 comment added Kevin Cruijssen I know it's been more than 2.5 years, but you can golf it some more: class K{public static void main(String[]y){int k,j=0,i=(int)(29*Math.random());for(;j++<30;i+=Math.random()*28>=i?1:-1)for(k=0;k<31;k++)System.out.print(k>29?10:k==i?'.':32);}} (176 - 10 - 50 = 116 bytes) (j=0 at initialization; j++ directly at for-check; replace strings with chars and use their integer value for two out of the three of them)
Feb 18, 2014 at 17:47 comment added Victor Stafusa @VadimR For me it looks right. I am fixing the start of the interval at 0 (i.e., imagine that i == x-1, so 0 < x < 30 implies -1 < i < 29 and then 0 <= i <= 28). If this does not changes the output, it is valid. So, 1 is actually the second position in the interval. If Math.random() returns 0, then the dot will go to the first position. Don't see a problem here.
Feb 18, 2014 at 17:40 comment added user2846289 I'm sorry, but it didn't fix anything. Imagine i gets 1 initially, and on first iteration Math.random() is 0, then i gets 0. Please don't get me wrong, it's not about your answer. Rather about my inability to read most languages other than C-like. Then with no reaction (except for upvotes) about errors, how can I know they are right or not?
Feb 18, 2014 at 17:22 comment added Victor Stafusa @VadimR, Oh, thanks. Fixed. This means that the dot will never be in the rightmost posistion, but anyway, that is what was specified.
Feb 18, 2014 at 17:21 history edited Victor Stafusa CC BY-SA 3.0
Fixed bug
Feb 18, 2014 at 17:08 comment added user2846289 "The number of spaces is the x position of your dot defined with 0 < x < 30" I.e. the number of spaces (or 0-based dot position) is 1..29. i can't be 0. I understand it's all about having fun but still it is sad.
Feb 18, 2014 at 16:46 comment added Victor Stafusa @VadimR, for me i is in the range [0-29]. This is equivalent to [1-30] or [288-317], the output would be the same. What matters is that there are 30 integer numbers in the interval [0-29].
Feb 18, 2014 at 16:13 comment added user2846289 But i getting to 0 is illegal, isn't it?
Feb 18, 2014 at 13:16 history edited Victor Stafusa CC BY-SA 3.0
shaving 1 char
Feb 18, 2014 at 1:29 history edited Victor Stafusa CC BY-SA 3.0
added 20 characters in body
Feb 18, 2014 at 1:21 history edited Victor Stafusa CC BY-SA 3.0
added 20 characters in body
Feb 18, 2014 at 1:15 history answered Victor Stafusa CC BY-SA 3.0