« first day (2358 days earlier)      last day (2478 days later) » 

11:04 AM
@LeakyNun 05AB1E, 8 bytes: [>Dfθ4‹#
(yay 1-byte factor builtin)
 
CMC:
||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|
|||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~|
||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|
|||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~|
~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|
|||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~|
||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|
|||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~||||~|
||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|||||||||~|
source:
I've drawn a curious pattern ... rextester.com/WXZV81312sergiol 2 days ago
 
Tcl, 125 bytes:
while {[incr j]<21} {set i 1;while {[incr i]<62} {if {[expr ($j*$i)%10]} {append s |} else {append s ~}};append s \n}
puts $s
well, yeah
at least I think charcoal would outgolf that by a lot...
 
@EriktheOutgolfer try to do it in Jelly
 
hmm...basically I can use some or something
 
I still have 0 idea how it is generated
 
11:14 AM
I have 0 idea of tcl whatsoever
:P
 
well you can see ($j*$i)%10
 
and you can see 21 and 62, so you can pretty much figure it out
 
dilemma: tcl approach or approach?
let's try both
 
16 bytes @EriktheOutgolfer
 
11:18 AM
wait a sec I'm organizing some stuff
ok did it in 21 now reducing to <16 if possible
17 18
back to 17
@LeakyNun close to your approach
but I can golf yours to 15
specifically, this is the golf I'm talking about
this was the approach of mine...seems I'm not that good at porting :p
 
12:12 PM
@EriktheOutgolfer nice
 
more downvotes!
wow
I may resign from ppcg :)
 
@Lembik downvotes happen. move on.
 
@LeakyNun but really quite a lot for what I think is a nice programming challenge
 
-9
Q: Are my eyes open or closed?

Leaky NunYou are trying to guess my emotion. I will give you an adjective, as the input to the function/program. Your task is to output the state of my eyes, either O_O for open, or ._. for closed. Details For these adjectives, you must output open eyes O_O animated breezy brisk driving enterprising ...

 
4 downvotes!
oh maybe more
 
12:20 PM
65
Q: Print a 10 by 10 grid of asterisks

Leaky NunBackground This is a standard textbook example to demonstrate for loops. This is one of the first programs I learnt when I started learning programming ~10 years ago. Task You are to print this exact text: ********** ********** ********** ********** ********** ********** ********** *********...

@Lembik this is my most upvoted challenge
It breaks down to +74/-9
 
what can I say :)
 
that's unfortunate
leaky has definitely more interesting challenges than that one
 
12:41 PM
My current most upvoted challenge has 4 close votes ;-;
 
@totallyhuman hmm... lemme cast one more ;p
 
:P wouldn't be surprising
 
nah, not in the mood to clear the votes
(if I hammer it and then reopen it, all the votes would be gone)
 
Mm
Jul 10 at 15:10, by totallyhuman
seriously hammers are weird
Anyways I have to wait 8 days for the votes to expire
Assuming nobody else votes to close
 
1:18 PM
i still agree with my close vote on that challenge
sorry bub
 
Mm s'fine I expected close votes
The hammers threw me off though o0
Besides I got a whole 142 rep and a couple of badges from it so...
 
CMC: Out of a given positive int array, extract every element greater than those adjacent to it, e.g. [4,2,6,7,4,5,4,3] yields [4,7,5]
 
@Phoenix nice
can I not output 4?
 
Huh? There's a 4 in the example output.
 
I mean, it's an edge case
 
1:30 PM
oic.
No, effectively edges are surrounded by 0s
 
Anonymous
@Phoenix So the first and last element should always be printed?
 
> edge case
Hehe
 
@Mego no.
 
Anonymous
It seems like having a virtual element at the beginning and end equal to the first and last element would be a better choice
 
@Mego No, the last element in the test case is smaller than the second to last element.
There may be a virtual 0 to its right, but that's not both surrounding elements.
 
Anonymous
1:31 PM
Oh, I read it as greater than at least one, not both
 
@Phoenix Jelly, 13 bytes: 0;;0»3\f"⁸¹Ðf
remove the last 4 bytes for uglier output
 
@Mego Would lambda b,a: not work?
 
@Phoenix it wouldn't work, because it is actually lambda b,a=[0]+b+[0]: which references b
 
Anonymous
Uses the oft-overlooked output format of returning a function that returns the result
 
Anonymous
1:35 PM
@Phoenix Nope, because function arg defaults can't refer to other args in the same function
 
Anonymous
There's probably a better way that's less hacky
 
Ah
 
@Phoenix CJam, 23 bytes: {T\T++3ew{(+(f<:&},1f=}
 
Anonymous
There's also a bug in that program
 
Anonymous
Fixed for 89: lambda b:lambda a=[0]+b+[0]:[a[i]for i in range(1,len(a)+1)if a[i]>a[i-1]and a[i]>a[i+1]]
 
1:37 PM
@LeakyNun The thing with the ugly output form is that it doesn't work great with 2-digit numbers. Could you just split the list by newlines or something, to or any other way to delimit in less than 4 bytes?
 
Anonymous
Less hacky for 80: lambda a:[a[i]for i in range(len(a))if a[i:i+1]>a[i-1:i]and a[i:i+1]>a[i+1:i+2]]
 
@Phoenix it is actually valid
(if you know Jelly :p)
ok, I can do it in 2 bytes
well, change the last three bytes to Y
 
That's pretty ugly but acceptable.
 
thanks :p
@Phoenix Jelly, 11 bytes: 0;;0»3\=⁸⁸x
 
DYK that C# has SQL in it? From an example given on the "Using LINQ in C#" page of the docs:
var CustomersQuery = from customers in northwindSampleDataContext1.Customers
                      where customers.Country == "US"
                      select customers;
 
1:44 PM
NIDK
 
That's kinda cool.
 
It's my mission to reply to any messages with "DYK" in it with "NIDK"
 
@totallyhuman case sensitive?
 
Based on context
 
@Phoenix you can do that on most collections so it does C# to it but if you use it on a Queryable it generates actual SQL.
 
1:47 PM
interesting
 
Yep, and you can interface with actual SQL databases, as well.
 
numpy's where function seems to return an empty list if the 2d array you pass it doesn't have equal width
 
anyone here knows arimaa?
 
@Phoenix you can also do LINQ in the more commonly accepted format
 
yeah EntityFramework and Dapper are the two most popular libraries that do that, so getting data from your data store is as easy as

var users = db.Users.ToList();
 
1:48 PM
@Mayube IK, it's quite good for golfing.
I had no idea about the SQL thing unitil actually looking up LINQ in the docs.
 
var CustomersQuery = northwindSampleDataContext1.Customers.Where((x)=>x.Country=="US");
 
@Mayube Yeah but when joins come up the query structure is WAYYY neater.
 
@Phoenix I'm still figuring out how the hell I would do it in R
 
@Mayube you can golf that with x=> instead of (x)=>
 
What's interesting in that example @Mayube gave is that the type of CustomerQuery is Queryable, which means it still hasn't executed against the db.
 
1:50 PM
@Phoenix I wasn't trying to be golfy
 
Anonymous
Using the fluent interface for LINQ allows you to do consumer functions, unlike the LINQ expressions.
 
@LiefdeWen CustomersQuery would be an IEnumerable<Customer>
 
Anonymous
AFAIK you can't do something like someQueryable.Select(x => x.Foo).ForAll(x => Console.WriteLine(x)) with a LINQ statement.
 
@Mayube northwindSampleDataContext1 tells me that they are using probably EntityFramework which then wouldn't make it an IEnumerable
 
@Mego How would you do that with the fluent interface?
 
Anonymous
1:52 PM
@Phoenix That is the fluent interface
 
Ah
I see.
 
@Mego I think it's ForEach not ForAll
 
Anonymous
A fluent interface means that expressions can be chained off of one another like that
 
Anonymous
@Mayube ForEach is a List method. ForAll is a PLINQ method.
 
PLINQ?
 
Anonymous
1:54 PM
To use ForEach, you'd need blahblah.ToList().ForEach(stuff)
 
Anonymous
@Phoenix Parallel LINQ
 
/shrug I only ever use LINQ on Lists and the like
 
Ah
I only use LINQ when ReSharper autoconverts a foreach loop I wrote to a linq expression.
 
@Phoenix lol and then the internal compiler makes it a foreach again
 
I think the internal compiler makes it a for
 
Anonymous
1:55 PM
List.ForEach requires the collection to be consumed and stored in a List first via ToList, which is undesirable for large collections. ForAll does things in parallel, but doesn't consume the entire list, so it uses less memory.
 
Considering there's a limit to how many values OEIS holds
Would my oeis library be valid?
 
Anonymous
@totallyhuman Valid? Yes. Useful? Less so.
 
For golfing
 
Anonymous
Also you should override __getitem__ and __contains__ for extra golfiness
 
I did..?
 
Anonymous
1:59 PM
Oh I'm blind
 
Anonymous
I should probably sleep at some point
 
I have both
I'm screwing around with good practise :P
 
Anonymous
You fetch from the sequence members list a lot - you should cache that so you only need to download it once
 
Mm yeah
Good point
Maybe I should just construct one list
I thought it might be too big to be efficient but...
 
Anonymous
Also I'd write return (int(value.split()[1]) for value in values.split('\n')) as for value in values.split('\n')): yield int(value.split()[1])
 
Anonymous
2:02 PM
@totallyhuman You're having to pay for that memory anyway when you fetch the data, so you might as well hold on to it
 
Fair enough
Plus it would clear my code up a lot too
Wait did I just turn tnb into code review D:
 
any feedback on this sandbox post?
 
2:17 PM
@dzaima It seems good. What you're asking for is tricky to specify properly, but you did it well, and the test cases cover everything I could think of.
 
@Phoenix So you'd say it's ready to get posted?
 
Ye
 
Couple things I would say: 1) Is it strictly integers? 2) You say negatives aren't possible, but is 0? If so, you should make a test case with 0
 
@BusinessCat Thought I mentioned that, thanks.
 
Other than that, seems fine
 
2:19 PM
Do my comments on this answer make sense. Could I have worded it any better to the OP?
 
@TheLethalCoder i think you were being reasonable
 
@BusinessCat does the edit cover what you mentioned?
 
@Poke Guess I'll take the good old stack exchange philosophy and move on then :)
 
@dzaima I think the last test case should be 84? Isn't 2+0 * 42 == (2+0)*42?
Or am I misunderstanding
 
@BusinessCat yep..
fixed. Apparently I can't do 2+0...
 
2:31 PM
@dzaima In other words (word? letter?): I.
 
hey guys.
 
\o
 
@Adám It'd be pretty funny if you could just eval the expressions in I and they worked...
 
I'm not getting any feedback on a post in the sandbox on this.. is it too long?
 
2:33 PM
@Adám that exists? Doesn't surprise me too much actually.
 
@BusinessCat I think you pretty much can.
@dzaima My colleague, Marshall, wrote it.
 
@Adám Given I is on TIO, could you show us an example?
IDK how to print things in I.
 
does the tag fit the question?
 
Yes
 
k, posting
 
2:37 PM
@Adám it's amusing how 3/4 of the stars are by PPCG users
 
@Phoenix Printing is implicit.
 
@Adám doesn't seem to follow the regular order of operations, trough.
 
^ this
 
it goes left to right
 
^ noticed that
 
2:42 PM
2+0=2, 2*42=84
 
@dzaima Ah, now I actually read your post. As CQ says, I is strictly left to right, but spaces dictate.
 
@Cowsquack and the other one is the creator themselves ><
 
0
Q: Logical Order of Operations

dzaimaTask Given an input, evaluate it as a mathematical equation following the order of operations. But, instead of the using PEMDAS, we drop the parentheses and exponentiation and introduce spaces - SMDAS - spaces, then multiplication & division, then addition & subtraction. How does that work? E...

 
@Cowsquack I don't understand.
 
3 of the 4 stars on the github repo were by PPCG users
 
2:53 PM
@Cowsquack TIL about GitHub stars.
 
3:09 PM
Is there a way to assign a variable in python without an =?
 
Uhh why?
But you might be able to modify the globals dict
 
@WheatWizard buffer overflow?
 
Oh jeez
 
0
Q: ASCII reflections in a box

Bruce ForteASCII reflections in a box You probably all know the Law of Reflection, in this challenge you'll visualize the trajectory of a ball in a box. Related: ASCII Ball in Box Animation and ASCII Doodling: Laser in a Box Task You're given three integer pairs W,H, x,y and dx,dy - the first represents...

 
I just came across this challenge from last year (somehow I must have missed it):
36
Q: Quixels - Quantum Pixels

NonlinearFruitIntroduction A quixel is a quantum pixel. Similar to a classical pixel, it is represented with 3 integer values (Red, Green, Blue). However, quixels are in a super position of these 3 states instead of a combination. This super position only lasts until the quixel is observed at which point it c...

(I was looking for any posts I could answer with quantum computing.)
I guess I would have to say, if I made this challenge, I would have used something other than RGB, and the resulting images probably would have looked a lot nicer.
In fact, I'm kinda curious what the best colors combinations would have been, this kinda reminds me of dithering algorithms too.
 
3:44 PM
@Phoenix R, 76 bytes: [function(a)a[a==apply(matrix(c(0,a,0)[outer(0:2,1:length(a),"+")],3),2,max)]]‌​(tio.run/##DYs7CoAwEAWvIla7@IT4h6AnEYtFjAoaJUTQ08cUUwzMuGCSPg/…)
RIP markdown
 
wait what python does not have async networking O_____O
@Cowsquack 1) is there GH issue 2) your username...
 
@Downgoat oh wait, there already is an issue
 
can you also please explain username :P O_o
 
so many people have already asked about the username change >_>
 
@Cowsquack Every time I look at your username, I think Cow Squack instead of Cows Quack
 
3:59 PM
I thought cows moo please help brain is breaking
 
but wait
goats don't moo?
 
@totallyhuman ಠ_ಠ goats bleet or baa
 
then what do ducks do O____O
 
@totallyhuman quack?
3
that's why ducks are called quackers
 
4:03 PM
wat
 
But what do sh**p do?
 
there is also a MarioKart Wii vehicle called the Quacker and it resembles a duck
 
Cool, basics of LMBM work now, can do a rough hello world program :D
 
LMBM = pLuMBuM? :P
 
LMBM = Lean Mean Bean Machine
2d language based on this challenge
 
4:12 PM
@DJMcMayhem Tell me when you post your CNR, I've been thinking about it and I'm really excited for it now.
 
0
Q: Put together a Senate majority

SneftelThere are one hundred members of the United States Senate. Assuming that nobody filibusters and that the Vice President isn't cooperating, at least fifty-one members are necessary to pass a bill. But some members work together better than others, entropy-wise. Your task: Output the last names of...

 
interesting, random.randint(0, 1) seems to favour 0, but random.choice([0, 1]) seems to be much more uniform
 
Hm. Not for me.
Sample size 1 million:
499375 : 500625
(0:1)
With random.choice it is a bit more uniform
500082 : 499918
The only largely significant difference I noticed though is that random.choice seems to be a lot faster :P
 
I didn't run as many tests, but using the following code in LMBM, I got A 18 times out of 100, wheras I didn't get D once, while with choice both were around 12 out of 100
   O
   ^
  ^ ^
 ^ ^ ^
" " " "
A B C D
U U U U
3 [0, 1] choices are made
all 0's leads to A, all 1's leads to D
 
hm ok
 
4:24 PM
ah well, I'll just stick to using choice
 
sure :P it's more uniform for me, and faster for you, so I guess that's the better choice :P
What if you do random.random() < 0.5?
 
@WheatWizard Oh cool, I'm glad you think that! I'll make sure to ping you once I post it, but I feel like it's got some work to do. I'd like to make sure it's as polished/ready as possible when I post it.
Do you have any thoughts on room for improvement?
 
Link?
 
2
A: Sandbox for Proposed Challenges

DJMcMayhemMake your language mostly unusable cops-and-robbers arithmetic Inspired by this comment... In this challenge, you are tasked with running some code that makes it so that your language no longer satisfies our criteria of being a programming language. In that challenge, that means making it so...

Dennis had some thoughts here
 
@Mayube actually they use the same random()
 
4:31 PM
> the number to find after the number
i suck at documentation
 
(cc @HyperNeutrino)
 
@Downgoat trying to get github to use a custom domain name
and afaict I do need one yes
I think I've got it now though
 
4:50 PM
In C(++), is there a better way of determining the value pointed to by an int* i than i[0]? I feel like there should be, but I don't know what it is.
 
@Phoenix define better
 
i[0] suggests i is an array, when it isn't.
 
try *i?
 
TY
(I am C noob)
 
a[b] is syntactic sugar for *((a)+(b))
(which makes i[0] equivalent to 0[i])
 
4:53 PM
I've always wondered how that made sense!
 
Wouldn't it be *((a)+(b*(size of whatever the array is holding)))
 
@BusinessCat pointer arithmetic already does that for you
 
Or am I mis-remembering
Alright
 
@BusinessCat see this
#include <stdio.h>
int main(int a){
	int b[10];
	printf("%d\n",b);
	printf("%d\n",b+1);
	printf("%d\n",b+2);
	printf("%d\n",b+3);
}
1229849904
1229849908
1229849912
1229849916
(the first output is random, the else is the previous one add 4)
 
then what goes in 1229849905?
 
4:55 PM
@Cowsquack the second byte of the int
one int is 4 bytes
 
I have int loc=b; does that mean loc contains the location of b?
 
what is b?
 
Then why does printing *b work while *loc borks?
@LeakyNun the array
 
Because int b[10] is actually an integer point but loc as just an integer
 

« first day (2358 days earlier)      last day (2478 days later) »