« first day (4208 days earlier)      last day (618 days later) » 

12:39 AM
@NoHaxJustRadvylf well in that case we need the feeds back for that while
I'mma add them temporarily until beep boops return - just for a few days at least
 
lyxal has made a change to the feeds posted into this room
lyxal has made a change to the feeds posted into this room
 
gives us some time to build up butter reserves :p
 
is it allowed in I/O if you're given a list to have an extra "EOF" at the end, like a 0?
 
of course
 
I'd guess no, but you might want to check the standard I/O
You could probably justify it as a trivial variation of null terminated strings
 
12:47 AM
^
 
@Steffan i think thats called a sentinel value, try searching for that
 
although come to think of it it might be questionable if the length is already also encoded some other way it still seems reasonable
 
@hyper-neutrino (or other mods) could we get the feeds renamed to New Posts and New Sandboxed Posts?
 
Personally I think it depends on context tho. In a language like Python or JS, I'd consider that just a cheap trick to avoid a byte in certain contexts, whereas in something like C or some weird esolang it's more justifiable
(Personally I'm against there being standard I/O at all)
 
oh yep heres the standard i/o post on sentinel value: codegolf.meta.stackexchange.com/a/24639/96039
 
12:49 AM
@lyxal I'd do either "New Posts" and "Sandbox Posts" (to match the bots) or "New Main Posts" and "New Sandboxed Posts" (to match the old feeds)
 
Sure, I wasn't fussed on the names, I was gonna leave that to the mod changing it lol
 
fwiw taking length as a separate parameter regardless of if the language itself needs that is established practice but using sentinels without it being off stdin is actually preprocessing to some extent
so the meta post is probably the best thing to follow, strictly
 
@NoHaxJustRadvylf I looked at the I/O rules but didn't really find much
@AidenChow oh ok thanks
but
> This can be applied to both inputs and outputs for languages such as C and assembly
is it still valid to do it in a normal lang where you could perfectly easily solve it without it :P
probably is
 
well it says langs such as C and assembly, not langs that are C and assembly :P
so its probably valid for any lang
if it isnt valid then i gotta change some of my piet answers lol
 
@Steffan Technically yes, but it would likely be considered cheaty
 
1:20 AM
ah yes, the question is the answer
I really wish that photo was edited with inspect element
but it wasn't
 
...what is this about
 
it's a quiz to do with database management
 
😔
 
 
3 hours later…
4:24 AM
0
Q: Tips for golfing in Knight

Aiden ChowKnight is the Language of the Month for August 2022, and I noticed that it didn't have a tips page, so here it is! I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Knight (e.g. "remove comments" is not an answer). Please post only o...

 
 
2 hours later…
6:39 AM
What happened to the NP/SP bots?
 
10 hours ago, by NoHaxJustRadvylf
NPSP is going to be down for a while, sorry. It seems that SE has made some major, possibly unintentional, changes to how some things work, and so I'm going to wait a little while to see if they get reverted, then it'll be a lengthy process to get everything working again if they don't.
 
6:55 AM
0
A: Sandbox for Proposed Challenges

py3programmerCorrect Quotations I noticed that in Microsoft Word, quotations are either ‘ or ’(double quotes: “ or ”), but not in Notepad. Your task today is: given a string q, convert all the ' characters (only) to ‘ or ’, according to these rules, and then output it: If the character before the quote is a ...

 
 
7 hours later…
1:35 PM
0
Q: PUT-PIXEL in every language

Kamil KiełczewskiDuring work on some project I need to be able to draw pixels on screen. I found some put-pixel function in JS but code was quite big and clumsy - so I wonder, how small put-pixel function can be... Challenge Create smallest put-pixel function. We count size of whole program: initialisation code (...

 
1:51 PM
any ideas for this lang?: gist.github.com/TvoozMagnificent/…
promise will have explanation coming out... soon
 
2:42 PM
Any Lenova users here?
I might get one
It felt very maccy
 
3:09 PM
@Adam if instead of getting no numbers between 0 and 0.1 you get 1, is the conditional probability that x=10 exactly 1/10?
 
3:25 PM
@mathcat My parents have a Lenovo that's like 14 years old. It still works (okay, it's slow, but I think that's partly because it's got a 32-bit chip)
It probably depends a lot on the specific model you're looking at though
 
4:00 PM
@mathcat what is your budget?
 
0
Q: Help me golf this C program

nullI could not think of a better title. This is a tips question. I'm asking for tips on golfing my code. I recently took part in a code golf competition in C. The competition ended and I lost. The problem is: Input a line with a number n. Then input n lines, each line contains only a set of cards i...

 
4:17 PM
Wait, I screwed up, ignore that
 
@Adam oh that's surprising! So just finding one number between 0 and 0.1 already makes it more likely that x=10?
Given that the prob is 1/10 before you start
 
I'm no statistician (I'm barely competent, honestly), so I might have messed up something simple, but that's what my results say
 
4:32 PM
I am grateful nonetheless. I think there might be a mistake though
CMQ anyone good at prob able to check the above please?
I guess one simple check is to see if the probs add up to 1 if you sum for x=1...10
What do you get for each x?
 
@graffe I don't think that's correct
These probabilities aren't all coming from the same set of events, so they can't be compared like that
 
Aren't we computing the prob x=10 given that one number is in 0...0.1?
It has to be one of 1,2,....10
We could simulate and only look at the cases where there is one number in 0...0.1 to check
 
It's not hard to simulate, yeah
 k P(X=10|k nums. in [0,0.1])
 0 0.0595
 1 0.1280
 2 0.2163
 3 0.3097
 4 0.4057
 5 0.5032
 6 0.6017
 7 0.7007
 8 0.8002
 9 0.9000
10 1.0000
 
Exactly as you said!
What I meant was the prob x=k given that 1 number is found for each k=1...10
That is what should add to 1
@Adam thank you so much. Shows how bad my intuition is for probability
 
4:54 PM
Actually, those are the theoretical calculations -- the simulation is still running
 
Aha :)
 
0
Q: Implement String Projection

bigyihsuanGiven two strings: a string s and an alphabet a, implement string projection in the shortest code possible. String projection returns a string o that contains the characters in s that are in a. The order of the characters in o must match the order of characters in s. So if s = "abcd" and a = "12da34

 
I look forward to seeing the simulation results!
 
0
A: Sandbox for Proposed Challenges

MirdropWrite a program on any language that accepts some input and give some different output. The challenge is that the text of the program must form a square: all rows must be the same length and the number of rows must equal the number of columns (ie length of rows). Adding extra spaces or comments t...

0
A: Sandbox for Proposed Challenges

MirdropWrite a program on any language that accepts some input and give some different output. The challenge is that the text of the program must form a square: all rows must be the same length and the number of rows must equal the number of columns (ie length of rows). Adding extra spaces, dead code, o...

 
I have invented a game based on this math problem
 
4:57 PM
Preliminary results for 10,000 cases:
0 0.059830605025907264
1 0.12846799788415764
2 0.2159897994564184
3 0.31566020609749584
4 0.3999270871308786
5 0.5481727574750831
6 0.5882352941176471
7 1.0
 
That looks wrong for 7
Does it only see that case once?
Apart from that I would say it supports your math
 
@graffe I didn't keep track, but probably... that's the reason that the results are not intuitive, I think -- the situations where very few of the numbers are in the range [0,0.1] are way more likely than the situations where a lot of the numbers are
 
How about this for a challenge? I am not sure which tag it would get. x is chosen uniformly from 1..10 and x values from 0...1 are chosen. In the game you have two possible moves. The first is to
look in the next interval of size 0.1 and the second is to choose a new x and set of points and start back at the beginning.
The cost of looking in an interval between a and a+0.1 is (10 a)^2
The goal is to report when x=10 as cheaply as possible
@Adam does that make sense?
@Adam yes you are completely right
 
In the game, are you trying to generate new x's until x=10?
 
Yes. But you don't know if an x=10 for sure until you have checked all the intervals and that is expensive
 
5:11 PM
Even if you've checked all the intervals, you can't be sure
 
Well you might know before that of course
@Adam why can't you be sure if you have checked all the intervals?
 
Oh wait, you're right, ignore that comment
 
I guess this is code-challenge
 
I think it's an interesting challenge, though I question the cost function
 
What would you prefer?
 
5:16 PM
e.g. in that case, the cost of checking [0,0.1] is 0, so the ideal strategy is to just keep on generating new x's until there are 10 values in [0,0.1]
 
I guess the cost could double for each successive interval
1 for the first, 2 for the second, then 4 etc
 
This is almost entirely a statistics question, which isn't necessarily bad, but is definitely not usual
 
@Adam ah yes. That should cost 1
@Adam I think there are coding ways to attack these things. Reinforcement learning?
 
I don't think that would work
 
How come?
 
5:19 PM
Well, I guess it could, but this is a simple problem, so it would be easy to find the mathematically optimal solution by hand and just implement that
 
If you set the goal as discovering x=10 and the reward as minus the new cost
@Adam that would be great but how?
 
Well, "easy" might not be the right word, but it's certainly tractable
 
I wouldn't know how to start
But I look forward to learning
Actually I have another maybe better related challenge
I will try to put it in the sandbox if I make my phone do that
Let me describe it here first :) if you are interested?
 
Sure
 
Consider four different symmetric random walks on the number line, all starting at the origin
You have one move which is to choose one of the four walks
When you do that an agent moves left or right by 1 with prob 1/2
If the agent is at 0 it always moves right
The goal is to get one agent to 10
The cost is the sum of the square of the number of moves (left or right) taken by all four agents
You want to minimise the expected cost
Is that clear?
 
5:37 PM
I think so, yeah
By the way, the results for the simulation with 10,000,000,000 finished:
0 0.05949956402034444
1 0.1279909701638522
2 0.21632340766424374
3 0.30972599985531724
4 0.4055237027651227
5 0.504442913957367
6 0.6053614876607577
7 0.7062058130400628
8 0.8222222222222222
9 1.0
 
0
A: Sandbox for Proposed Challenges

graffeOptimal strategy for wandering robots Consider four agents sitting on four different number lines, all starting at the origin. In this game your input move is to choose one of the four agents to move. When you do that the agent you have chosen moves left or right by 1 with prob 1/2. If the agent ...

 
6:12 PM
@Adam that's cool.I assume 9 only got one instance
Please do read and comment on my sandboxed question
 
 
2 hours later…
8:44 PM
Tryna resist the urge to rewrite NP/SP in Rust
 
@NoHaxJustRadvylf Stop resisting. Embrace oxidation
 
What is np/sp?
 
9:01 PM
New Posts/Sandbox Posts, the bots that (normally) post new posts from main/meta/the sandbox into the chat room
 
9:12 PM
Node.js is weird about making it really easy to do some HTTP/network stuff with, and really hard to do other stuff
I had to write my own requests library from scratch to get it to handle cookies right
(Which I didn't do very well, and it's likely one of the things that's caused NP/SP to break without chatbot.py, which has the luxury of an actually good HTTP library, from doing the same)
I've been planning to rewrite NP/SP from scratch for more than a year now, but I can't work up the motivation to do it in Node (and whenever I can, the cookie RFC causes me too much physical pain to continue), so maybe Rust (or if there aren't sufficiently good libraries for HTTP stuff with cookies, maybe Python or Go or something) would be a good idea
 
9:32 PM
0
A: Sandbox for Proposed Challenges

tybocopperkettleDraw an N out of Ns given N Your challenge is to draw an ASCII art capital letter N that is n characters tall and wide, only using the capital letter N. The examples below should make it clear. Test cases n = 4 N N NN N N NN N N n = 5 N N NN N N N N N NN N N Rules: Trailing spaces ar...

 
@SandboxPosts I'm certain this is a dupe
Pretty sure there's a multipart challenge, with 3 parts, where the first one is to do that, but I can't find it :/
 
173
Q: Programming Languages Through The Years

Calvin's HobbiesIn this challenge, users will take turns completeing three fairly simple coding tasks in programming languages that are allowed to be progressively older. The first answer must use a programming language that was made in the year 2015. Once there is at least one answer from a 2015 language, answ...

 
Ah, I thought it was one of Calvin's :P
 
9:49 PM
there is a difference that that is a popcon and the one in the sandbox is codegolf
 
True, and the sandbox one allows even sizes
 
Looks like he deleted it
 
Yeah, they aren't the same, but tbh, I'm not entirely sure if the sandbox challenge is that interesting
We've had quite a lot of similar ascii-art challenges
 
 
1 hour later…
11:18 PM
23
Q: Backronymiser឵឵

pxegerBackground A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail". Challenge Given a string a, and a word t, capitalise the c...

 

« first day (4208 days earlier)      last day (618 days later) »