I figured I'd start this since, worst-case scenario, I have a fun little weekly project to post on the side.
Welcome to King Put's Code Mini-Golf & Speedway
Voted the 252nd Greatest Idaho-Registered Attraction of 1987Admittedly, the green is a little faded and most of the go-karts don't run, but don't let that (or the vagrant bathing in the water features) turn you off! We're just as great as any other Code Golf competition! Even moreso, since our reputation and ownership of less than ten golf balls means that you can hardly try and still feel good about yourself!
How This WorksHere at King Put's, we don't rent out our golf clubs for a single round. Rather, you get
One Entire Week to post a solution to any given problem. Solutions are due at
12:00 UTC on the next Friday. New Problems will be posted whenever our minimum-wage staff stop snorting Smarties in the break room.
And remember how I said we rent our golf clubs?
That's a lie! We actually don't own any golf clubs, since those were used to replace the blades of our windmill. We really just sell you a license to use your own.
You can use any golf-club (language) you want to, regulation or not. The only requirement is that
there is no sharing golf-clubs, so all solutions sharing a language must be unique in program structure. The first working solution in a given language will get the distinction of being "uncopyable".
In order to prove that your golf club is working and not secretly a frozen snake (we don't play Canadian golf here, buckaroo),
you must publicly post your solution on the forum. Solution "order" will go by timestamp of the post, so you may only claim code once it is up. Notably,
iterations on code that improve or change the execution in noticable ways do not count as "copycats". If you spot an improvement and are the first to post the revised edition,
it's yours.
Finally, because we are a family-friendly establishment
and not because we accept bribes from players (VenMo: KingPutsCodeGolf), there are
no winners or losers. Particularly because different languages have different rules and minimum program sizes,
the only goal is to have fun in a recreational (non-competitive) manner. You
can compete if you wish, but winners will not be recorded. If you do wish to compete, however, our old, not-mildew-stained score cards judged on three properties:
Runtime Complexity, Code Compression, and Readability. Feel free to use that to refine your code as you wish.
That's it! Welcome to King Put's, have fun, and avoid hole nine as it's currently infested with rabid raccoons! Please follow this thread if you wish to be updated as new problems come out!70.522 days ago
Mar 31, 2023 - 7:24 PM
Hole 1: Skipping Shopper
Description Joanna enjoys cooking, but is on a tight budget. In order to save both time and money, she has a specific algorithm she employs while at the supermarket. When starting in an aisle, she picks an item and looks at its price. She then skips an amount of items equal to that price, and looks at the next item. She is also very stubborn and will only start looking at the first five items in the aisle. She needs your help figuring out the optimal starting place!
InputThe input will be a single line of up to one-hundred space-delimited integers with values between one and one-hundred.
OutputYou will output the ideal starting position (one-indexed!) and the cheapest item Joanna will find on that path.
ExamplesInput:6 5 4 3 2 1 3 3 3 3 3
Output:5
2
Explanation:6 5 4 3 2 1 3 3 3 3 3
^ ^ ^
ExamplesInput:3 7 5 6 4 8 2 6 4 1 4 1
Output:1
1
Explanation:3 7 5 6 4 8 2 6 4 1 4 1
^ ^ ^ ^
Solutions are due 11:59PM UTC on Friday, Apr. 7 2023
70.521 days ago
Mar 31, 2023 - 7:25 PM
shopper.c [O(n) runtime, 189 bytes]
Language: C#include <stdio.h>
int main(){int b[100],i=0,s=0,m=101,c=-1;do{c++;}while(scanf("%d ",b+i++)!=EOF);for(int k=0;k<5;){i=k++;while(i<c){if(b[i]<m){m=b[i];s=k;}i+=b[i];}}printf("%d\n%d",s,m);}
This will be used as a benchmark program70.474 days ago
Mar 31, 2023 - 8:33 PM
Dang, starting it off with something that looks like a DP problem? Might stop by every once in a while to see some of these problems.
EDIT: though looking at it, the constraint that she only looks at the first 5 elements for starting items makes it less DP than expected.
70.433 days ago
Mar 31, 2023 - 9:32 PM
There's no runtime limits technically speaking, so it doesn't really fit DP unless you are trying to optimize.
The whole point of the thread is to allow optimization and compression to be fostered by the same problem.
EDIT: I think complete search is the only viable approach here anyway, since a DP array adds substantial length without asymptotic changes
70.432 days ago
Mar 31, 2023 - 9:33 PM
Language: Brainfuck
, > +++++ +++++ [ < [ -> +++++ +++++ < ] > - ]
> [ > ++++++++++ < - ]
> [ > ++++++++++ < - ]
> [ > ++++++++++ < - ]
> [ > ++++++++++ < - ]
> < [ - < < + > > [ -> + < ] < [ -> + < ] < [ -> + < ] < [ -> + < ] < - ]
[ < [ - > + < ] > - ]
[ - < + > ] > .
[ - < + > ] > .
i can almost guarantee that this code does not work
I just copy and pasted the problem into chat GPT because i cant code
70.421 days ago
Mar 31, 2023 - 9:49 PM
Does not work at all. Actually, that leading comma isn't even an accepted brainfuck directive.
70.416 days ago
Mar 31, 2023 - 9:57 PM
ChatGPT is terrible at brainfuck; I can confirm
70.415 days ago
Mar 31, 2023 - 9:58 PM
I have a terrible language to write in, and I dont want to attempt to code it in.
70.408 days ago
Mar 31, 2023 - 10:07 PM
I'm programming that in the language I made. One moment.
69.741 days ago
Apr 1, 2023 - 2:08 PM
#!/usr/bin/env sh
printf '%s\n' '#include <stdio.h>' 'int main(){int b[100],i=0,s=0,m=101,c=-1;do{c++;}while(scanf("%d ",b+i++)!=EOF);for(int k=0;k<5;){i=k++;while(i<c){if(b[i]<m){m=b[i];s=k;}i+=b[i];}}printf("%d\n%d",s,m);}'|cc -xc -&&(read a;printf "$a"|./a.out)
68.161 days ago
Apr 3, 2023 - 4:03 AM
Clever.
Not patching that loophole, 'cause it's funny.
67.982 days ago
Apr 3, 2023 - 8:22 AM
Could you tell us people who dont know how to code what it is?
67.928 days ago
Apr 3, 2023 - 9:39 AM
67.888 days ago
Apr 3, 2023 - 10:37 AM
Could you tell us people who dont know how to code what it is?
It's basically taking the example C program that Kyle gave and telling the computer "build and run this script" instead of actually writing a solution in his chosen language.
67.87 days ago
Apr 3, 2023 - 11:03 AM
Had a feeling, with what appeared to be making the environment a shell environment and shell commands.
67.529 days ago
Apr 3, 2023 - 7:13 PM
Yeah:
1. prints the program to stdout
2. pipes stdout into a compiler
3. reads stdin into a variable $a
4. prints the variable into stdout
5. pipes stdout into the compiled program
Funny loophole that effectively allows you to copy any solution into a "separate" language via shell scripting, thus making it valid.
67.479 days ago
Apr 3, 2023 - 8:26 PM
I doubt I'll finish in time, but I am working on a brainfuck implementation of this algorithm
67.442 days ago
Apr 3, 2023 - 9:19 PM
yesssss i hope you finish
67.371 days ago
Apr 3, 2023 - 11:02 PM
There was an attempt at writing a solution in ><>. Unfortunately, it would be both a longer runtime and more characters used, so I gave up lol
67.332 days ago
Apr 3, 2023 - 11:58 PM
The Dummy solution is gonna be so fucking good. I just need to get my stupid fucking baby brain to understand the problem. After that? 6502. I know I can do it.
My Dummy code will be untestable because I have yet to write a compiler for it. In the process of learning LLVM for just that though.
67.275 days ago
Apr 4, 2023 - 1:19 AM
i dont even understand the problem
67.275 days ago
Apr 4, 2023 - 1:20 AM
Unfortunately, it would be both a longer runtime and more characters used, so I gave up lol
Whole point of this thread is that is is non-competetive. The point is writing the solutions and challenging yourself, not competing with others.
67.262 days ago
Apr 4, 2023 - 1:38 AM
And because the course is going through some hard times and can't really afford winner prizes for any competitions.
67.243 days ago
Apr 4, 2023 - 2:05 AM
Whole point of this thread is that is is non-competetive. The point is writing the solutions and challenging yourself, not competing with others.
Hm, then maybe I'll give it another chance. Gonna be difficult though.
67.23 days ago
Apr 4, 2023 - 2:23 AM
{
"thread_id": "12169",
"posts": [
{
"id": "1284745",
"time": "1680290678",
"html": "<div style=\"font-style:italic;color:#888;\">I figured I'd start this since, worst-case scenario, I have a fun little weekly project to post on the side.</div><br /><h2 class=\"heading\">Welcome to King Put's Code Mini-Golf & Speedway</h2><span style=\"font-weight:bold;\"><span style=\"font-style:italic;\">Voted the 252nd Greatest Idaho-Registered Attraction of 1987</span></span><br /><br />Admittedly, the green is a little faded and most of the go-karts don't run, but don't let that (or the vagrant bathing in the water features) turn you off! We're just as great as any other Code Golf competition! Even moreso, since our reputation and ownership of less than ten golf balls means that you can hardly try and still feel good about yourself!<br /><br /><span style=\"font-weight:bold;\">How This Works</span><br />Here at King Put's, we don't rent out our golf clubs for a single round. Rather, you get <span style=\"font-weight:bold;\">One Entire Week</span> to post a solution to any given problem. Solutions are due at <span style=\"font-weight:bold;\">12:00 UTC on the next Friday</span>. New Problems will be posted whenever our minimum-wage staff stop snorting Smarties in the break room.<br /><br />And remember how I said we rent our golf clubs? <span style=\"font-style:italic;\">That's a lie</span>! We actually don't own any golf clubs, since those were used to replace the blades of our windmill. We really just sell you a license to use your own. <span style=\"font-weight:bold;\">You can use any golf-club (language) you want to, regulation or not</span>. The only requirement is that <span style=\"font-weight:bold;\">there is no sharing golf-clubs, so all solutions sharing a language must be unique in program structure</span>. The first working solution in a given language will get the distinction of being "uncopyable".<br /><br />In order to prove that your golf club is working and not secretly a frozen snake (we don't play Canadian golf here, buckaroo), <span style=\"font-weight:bold;\">you must publicly post your solution</span> on the forum. Solution "order" will go by timestamp of the post, so you may only claim code once it is up. Notably, <span style=\"font-weight:bold;\">iterations on code that improve or change the execution in noticable ways <span style=\"font-style:italic;\">do not count as "copycats"</span></span>. If you spot an improvement and are the first to post the revised edition,<span style=\"font-weight:bold;\"> it's yours</span>.<br /><br />Finally, because we are a family-friendly establishment <span style=\"text-decoration:line-through;\">and not because we accept bribes from players <span style=\"font-weight:bold;\">(VenMo: KingPutsCodeGolf)</span></span>, there are <span style=\"font-weight:bold;\">no winners or losers</span>. Particularly because different languages have different rules and minimum program sizes, <span style=\"font-weight:bold;\">the only goal is to have fun in a recreational (non-competitive) manner</span>. You <span style=\"font-style:italic;\">can</span> compete if you wish, but winners will not be recorded. If you do wish to compete, however, our old, not-mildew-stained score cards judged on three properties: <span style=\"font-weight:bold;\">Runtime Complexity, Code Compression, and Readability</span>. Feel free to use that to refine your code as you wish.<br /><br /><span style=\"font-weight:bold;\">That's it! Welcome to King Put's, have fun, and avoid hole nine as it's currently infested with rabid raccoons! Please follow this thread if you wish to be updated as new problems come out!</span>",
"user": "kylljoy"
},
{
"id": "1284746",
"time": "1680290719",
"html": "<h2 class=\"heading\">Hole 1: Skipping Shopper </h2><span style=\"font-weight:bold;\">Description</span> <br />Joanna enjoys cooking, but is on a tight budget. In order to save both time and money, she has a specific algorithm she employs while at the supermarket. When starting in an aisle, she picks an item and looks at its price. She then skips an amount of items equal to that price, and looks at the next item. She is also very stubborn and will only start looking at the first five items in the aisle. She needs your help figuring out the optimal starting place!<br /><br /><span style=\"font-weight:bold;\">Input</span><br />The input will be a single line of up to one-hundred space-delimited integers with values between one and one-hundred.<br /><br /><span style=\"font-weight:bold;\">Output</span><br />You will output the ideal starting position (one-indexed!) and the cheapest item Joanna will find on that path.<br /><br /><span style=\"font-weight:bold;\">Examples</span><br /><br /><span style=\"font-weight:bold;\">Input:</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">6 5 4 3 2 1 3 3 3 3 3</div><br /><span style=\"font-weight:bold;\">Output:</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">5<br />\n2</div><br /><span style=\"font-weight:bold;\">Explanation:</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">6 5 4 3 2 1 3 3 3 3 3<br />\n ^ ^ ^</div><br /> <span style=\"font-weight:bold;\">Examples</span><br /><br /><span style=\"font-weight:bold;\">Input:</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">3 7 5 6 4 8 2 6 4 1 4 1</div><br /><span style=\"font-weight:bold;\">Output:</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">1<br />\n1</div><br /><span style=\"font-weight:bold;\">Explanation:</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">3 7 5 6 4 8 2 6 4 1 4 1<br />\n^ ^ ^ ^</div><br /><br /><div style=\"font-style:italic;color:#888;\">Solutions are due 11:59PM UTC on Friday, Apr. 7 2023</div>",
"user": "kylljoy"
},
{
"id": "1284763",
"time": "1680294811",
"html": "<h2 class=\"heading\">shopper.c [O(n) runtime, 189 bytes]</h2><span style=\"font-weight:bold;\">Language: C</span><br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">#include <stdio.h><br />\nint main(){int b[100],i=0,s=0,m=101,c=-1;do{c++;}while(scanf("%d\u00a0",b+i++)!=EOF);for(int k=0;k<5;){i=k++;while(i<c){if(b[i]<m){m=b[i];s=k;}i+=b[i];}}printf("%d\\n%d",s,m);}</div><br /><br /><span style=\"color:#0000ff;\"><span style=\"font-weight:bold;\">This will be used as a benchmark program</span></span>",
"user": "kylljoy"
},
{
"id": "1284789",
"time": "1680298325",
"html": "Dang, starting it off with something that looks like a DP problem? Might stop by every once in a while to see some of these problems.<br /><br />EDIT: though looking at it, the constraint that she only looks at the first 5 elements for starting items makes it less DP than expected.",
"user": "mathmaniac125"
},
{
"id": "1284790",
"time": "1680298428",
"html": "There's no runtime limits technically speaking, so it doesn't really fit DP unless you are trying to optimize.<br /><br />The whole point of the thread is to allow optimization and compression to be fostered by the same problem.<br /><br />EDIT: I think complete search is the only viable approach here anyway, since a DP array adds substantial length without asymptotic changes",
"user": "kylljoy"
},
{
"id": "1284792",
"time": "1680299369",
"html": "Language: Brainfuck<br /><div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">, > +++++ +++++ [ < [ -> +++++ +++++ < ] > - ]<br />\n> [ > ++++++++++ < - ]<br />\n> [ > ++++++++++ < - ]<br />\n> [ > ++++++++++ < - ]<br />\n> [ > ++++++++++ < - ]<br />\n> < [ - < < + > > [ -> + < ] < [ -> + < ] < [ -> + < ] < [ -> + < ] < - ]<br />\n[ < [ - > + < ] > - ]<br />\n[ - < + > ] > .<br />\n[ - < + > ] > .<br />\n</div><br /><br />i can almost guarantee that this code does not work<br /><br />I just copy and pasted the problem into chat GPT because i cant code",
"user": "dementedkermit"
},
{
"id": "1284795",
"time": "1680299827",
"html": "Does not work at all. Actually, that leading comma isn't even an accepted brainfuck directive.",
"user": "kylljoy"
},
{
"id": "1284796",
"time": "1680299903",
"html": "ChatGPT is terrible at brainfuck; I can confirm",
"user": "aprzn123"
},
{
"id": "1284798",
"time": "1680300475",
"html": "I have a terrible language to write in, and I dont want to attempt to code it in.",
"user": "broncoboy18"
},
{
"id": "1285043",
"time": "1680358105",
"html": "I'm programming that in the language I made. One moment.",
"user": "hoylecake"
},
{
"id": "1285720",
"time": "1680494617",
"html": "<div style=\"text-align:left;background-color:#e8e8e8;padding:12px;-moz-border-radius:8px;border-radius:8px;font-family:"Courier New", monospace;overflow:auto;\">#!/usr/bin/env sh<br />\nprintf '%s\\n' '#include <stdio.h>' 'int main(){int b[100],i=0,s=0,m=101,c=-1;do{c++;}while(scanf("%d ",b+i++)!=EOF);for(int k=0;k<5;){i=k++;while(i<c){if(b[i]<m){m=b[i];s=k;}i+=b[i];}}printf("%d\\n%d",s,m);}'|cc -xc -&&(read a;printf "$a"|./a.out)<br />\n</div>",
"user": "user64837"
},
{
"id": "1285726",
"time": "1680510124",
"html": "Clever.<br /><br />Not patching that loophole, 'cause it's funny.",
"user": "kylljoy"
},
{
"id": "1285730",
"time": "1680514792",
"html": "Could you tell us people who dont know how to code what it is?",
"user": "broncoboy18"
},
{
"id": "1285735",
"time": "1680518250",
"html": "Sigh.",
"user": "hoylecake"
},
{
"id": "1285736",
"time": "1680519794",
"html": "<div style=\"margin:20px; background-image:url(/images/light.png);\"><div style=\"border:1px solid #888; padding:5px;\"><a href=\"/users/broncoboy18\">BroncoBoy18</a> said:</div><div style=\"border:1px solid #888; padding:20px;\">Could you tell us people who dont know how to code what it is?</div></div><br />It's basically taking the example C program that Kyle gave and telling the computer "build and run this script" instead of actually writing a solution in his chosen language.",
"user": "aprzn123"
},
{
"id": "1285914",
"time": "1680549228",
"html": "Had a feeling, with what appeared to be making the environment a shell environment and shell commands.",
"user": "mathmaniac125"
},
{
"id": "1285921",
"time": "1680553594",
"html": "Yeah:<br />1. prints the program to stdout<br />2. pipes stdout into a compiler<br />3. reads stdin into a variable $a<br />4. prints the variable into stdout<br />5. pipes stdout into the compiled program<br /><br />Funny loophole that effectively allows you to copy any solution into a "separate" language via shell scripting, thus making it valid.",
"user": "kylljoy"
},
{
"id": "1285932",
"time": "1680556767",
"html": "I doubt I'll finish in time, but I am working on a brainfuck implementation of this algorithm",
"user": "aprzn123"
},
{
"id": "1285952",
"time": "1680562929",
"html": "yesssss i hope you finish",
"user": "dementedkermit"
},
{
"id": "1286011",
"time": "1680566283",
"html": "There was an attempt at writing a solution in ><>. Unfortunately, it would be both a longer runtime and more characters used, so I gave up lol",
"user": "mathmaniac125"
},
{
"id": "1286076",
"time": "1680571171",
"html": "The Dummy solution is gonna be so fucking good. I just need to get my stupid fucking baby brain to understand the problem. After that? 6502. I know I can do it.<br /><br /><div style=\"font-style:italic;color:#888;\">My Dummy code will be untestable because I have yet to write a compiler for it. In the process of learning LLVM for just that though.</div>",
"user": "hoylecake"
},
{
"id": "1286077",
"time": "1680571228",
"html": "i dont even understand the problem",
"user": "dementedkermit"
},
{
"id": "1286119",
"time": "1680572287",
"html": "<div style=\"margin:20px; background-image:url(/images/light.png);\"><div style=\"border:1px solid #888; padding:5px;\"><a href=\"/users/mathmaniac125\">Mathmaniac125</a> said:</div><div style=\"border:1px solid #888; padding:20px;\">Unfortunately, it would be both a longer runtime and more characters used, so I gave up lol</div></div><br />Whole point of this thread is that is is non-competetive. The point is writing the solutions and challenging yourself, not competing with others.",
"user": "kylljoy"
},
{
"id": "1286157",
"time": "1680573909",
"html": "And because the course is going through some hard times and can't really afford winner prizes for any competitions.",
"user": "caveat"
},
{
"id": "1286177",
"time": "1680575038",
"html": "<div style=\"margin:20px; background-image:url(/images/light.png);\"><div style=\"border:1px solid #888; padding:5px;\"><a href=\"/users/kylljoy\">Kylljoy</a> said:</div><div style=\"border:1px solid #888; padding:20px;\">Whole point of this thread is that is is non-competetive. The point is writing the solutions and challenging yourself, not competing with others.</div></div><br /><br />Hm, then maybe I'll give it another chance. Gonna be difficult though.",
"user": "mathmaniac125"
}
],
"users": {
"kylljoy": {
"name": "Kylljoy",
"key": "kylljoy",
"url": "/users/kylljoy",
"avatar": "/uploads/drawn/26951.png",
"rankClass": "civilian",
"rankText": "",
"posts": "4927"
},
"mathmaniac125": {
"name": "Mathmaniac125",
"key": "mathmaniac125",
"url": "/users/mathmaniac125",
"avatar": "/uploads/drawn/41479.png",
"rankClass": "civilian",
"rankText": "",
"posts": "4658"
},
"dementedkermit": {
"name": "dementedkermit",
"key": "dementedkermit",
"url": "/users/dementedkermit",
"avatar": "/uploads/drawn/24472.png",
"rankClass": "civilian",
"rankText": "",
"posts": "12788"
},
"aprzn123": {
"name": "aprzn123",
"key": "aprzn123",
"url": "/users/aprzn123",
"avatar": "/uploads/drawn/23412.png",
"rankClass": "civilian",
"rankText": "",
"posts": "7005"
},
"broncoboy18": {
"name": "BroncoBoy18",
"key": "broncoboy18",
"url": "/users/broncoboy18",
"avatar": "/uploads/drawn/21075.png",
"rankClass": "civilian",
"rankText": "",
"posts": "10491"
},
"hoylecake": {
"name": "hoylecake",
"key": "hoylecake",
"url": "/users/hoylecake",
"avatar": "/uploads/drawn/42626.png",
"rankClass": "civilian",
"rankText": "",
"posts": "6509"
},
"user64837": {
"name": "user64837",
"key": "user64837",
"url": "/users/user64837",
"avatar": "/uploads/drawn/30000.png",
"rankClass": "civilian",
"rankText": "",
"posts": "414"
},
"caveat": {
"name": "caveat",
"key": "caveat",
"url": "/users/caveat",
"avatar": "/uploads/drawn/39364.png",
"rankClass": "civilian",
"rankText": "",
"posts": "3265"
}
},
"page_num": 1,
"locked": 0,
"total_pages": 2
}