code-golf / code-golf Goto Github PK
View Code? Open in Web Editor NEWA game designed to let you show off your code-fu by solving problems in the least number of characters.
Home Page: https://code.golf
License: MIT License
A game designed to let you show off your code-fu by solving problems in the least number of characters.
Home Page: https://code.golf
License: MIT License
If this all works it'll be good enough, long term it would be nice to be able to update assets without having to rebuild the binary on dev, or at least detect the change and automatically rebuild.
In my Haskell quine, I use putStr, which should print without a newline. However, I still have to add a newline at the end of the source to make it valid
Otherwise the program can produce buggy output but get a lucky pass.
I have a small HTTP wrapper around mueval (+a set of common extension libs that make golfing possible), see https://github.com/robinp/repli.
What would it take to get Haskell supported?
My brainfuck solution that just encodes the answers in a lookup table is shorter than all the other entries. I suggest adding a test case that generates a long and difficult to generate blob of text.
Here is one example
Input: "+++++[>+++++[>++>++>+++>+++>++++>++++<<<<<<-]<-]+++++[>>[>]<[+.<<]>[++.>>>]<[+.<]>[-.>>]<[-.<<<]>[.>]<[+.<]<-]"
Output: "eL34NfeOL454KdeJ44JOdefePK55gQ67ShfTL787KegJ77JTeghfUK88iV9:XjgYL:;:KfiJ::JYfijgZK;;k[<=]lh^L=>=KgkJ==J^gklh_K>>m`?@bnicL@A@KhmJ@@JchmnidKAA"
It would also be nice to extend this hole to implement all of brainfuck and accept input. Either alternate code arguments with input arguments, or put code and input separated with a "!" for each argument, as I've seen some other sites do.
My current Perl 6 solution for the emirps hole (49 bytes) shows as tied with a 50 byte solution at 13th place. When filtering by only Perl 6 solutions, it displays correctly.
I've also noticed xsot's 57 byte Ruby solution is also misplaced at 17th. Also solutions at 95th,125th, 128th, and 136th (last but not least)
Just played a hole, saw my rating, tried going back to the editor to improve and... my code is nowhere to be found. I may be missing something, in which case should better document how to access own submittals - but if they are not available, they should be - for example when clicking on the board that shows i have already played a problem/lang combo - re-direct me to my best solution (or history of my attempts)?
Rule 110 doesn't really explain how you're meant to solve it, this would be a simple Hacktoberfest issue, you only need to edit holes.toml
It seems that the solution is correct even if there are some warnings in stderr. Is it supposed to be like this?
Those holes both say that:
The space between words is seven units
However, it seems like the space between words is actually ten units.
I see that a task can either be green, yellow, or red. However, I'm failing to see any logic for the current color coding.
I'm proposing to change the colors like this:
Task | Color | New color | ≈length of minimal solution |
---|---|---|---|
99 Bottles of Beer | GREEN | YELLOW | 206 |
Fibonacci | GREEN | GREEN | 18 |
Fizz Buzz | GREEN | GREEN | 39 |
Prime Numbers | GREEN | GREEN | 24 |
Arabic to Roman | YELLOW | RED | 112 |
Pascal's Triangle | YELLOW | GREEN | 31 |
Seven Segment | YELLOW | YELLOW | 112 |
Spelling Numbers | YELLOW | RED | 362 |
𝑒 | RED | YELLOW | 105 |
π | RED | YELLOW | 192 |
It is easy to generate 1000 characters of π and 𝑒 in under 10 seconds (on a relatively old hardware), but because the limit is 2 seconds, these solutions are not accepted at all.
Moreover, these solutions are definitely shorter than the currently winning hacks, so it seems unfair that “proper” solutions are not accepted.
I don't know, maybe performance should be taken into account. But if I can generate 1000 digits of π in 9 seconds on my old laptop, why can't we accept it? It's not like I'm asking for 10 hours :)
I have tested a solution which should work and it says the solution is wrong, giving the expected output and standard output. I have copied and pasted them independently on a text compare application and they are both identical.
I noticed that \r sequence is not available. there is a particular reason?
It is useful to clear the output and it's used in golf
$|++;for(1..$ARGV[0]){print qq(\r$_);sleep 1;}
At the moment, the leaderboard has several solutions with a zero-length answer.
I'm hitting Killed for exceeding 750ms timeout.
error when doing 99 Bottles of Beer task. On my old laptop it runs in 550ms, where half of that is rakudo startup. Somehow it feels like this limit was not intended to be so low.
It would be nice if there was a time out message for when your code goes over the 5 second limit. I spent way too long 'debugging' before I realised my code worked perfectly fine locally. (On a side note, my Perl 6 BF solution finishes in less than 3 seconds locally, but times out here :(
)
Sorry don't have time to investigate now, but I think that there are only a few letters that you have to check in order to get the right output. Feel free to disqualify my 29 character submission (and replace it with 30 character one).
The letters Q, I, C, and K don't appear in the test case, so it's possible to cheat.
Add Jullia programming language. It has many things for code golfing
Current score table for Quine task:
Place | Lang | Score | Name |
---|---|---|---|
1st | Bash | 19 | AlexDaniel |
2nd | Ruby | 28 | tom-lord |
2nd | Ruby | 28 | greghull |
4th | Perl5 | 31 | JRaspass |
5th | PHP | 137 | joegreen88 |
The problem is that Perl 6 is not in the table even though there is a 41 character solution in it.
Redesign the "hole" page to be both lighter and fix some long standing issues.
Available to try on live by prefixing a hole with "ng/", e.g. https://code-golf.io/ng/divisors
I'll update master with force commits for the time being, this redesign might take awhile, don't expect "ng/" to always work.
This was mentioned in #2.
Maybe this ticket can be the place where we can discuss ideas for new holes.
For example, it took me a while to realize that the sentences given as arguments in the Pangram Grep hole are not one and the same argument, and I thought I had to recognize punctuation too. I'd say that a new textbox should be made for each argument or something.
The quine r='r=%r;print(r%%r)';print(r%r)
succesfully prints exactly itself to standard output, but is not accepted as a correct answer.
According the the About page:
"Only STDOUT is checked against the solution, STDERR is however shown back to you to ease debugging."
This is however not true for PHP. Errors and even Warnings are sent to STDOUT. This can be changed in the .ini with display_errors = stderr
.
For example, the following issues a Warning to STDERR, while outputting INF
:
ini_set('display_errors', 'stderr');
echo 1/0
Some languages are more apt for golfing than others and dominate the Top 5 . It would be nice to have a language filter to see the Top 5 for all holes per language.
There is a JS error when I type the following PHP code:
?><?
The same error occurs if there is text between the tags:
?>foo bar<?
Stack trace:
Uncaught TypeError: r.indent is not a function
at Object.token (aVYNTJK5PuEMBYVX5U9kdw:429)
at Ld (aVYNTJK5PuEMBYVX5U9kdw:43)
at ze (aVYNTJK5PuEMBYVX5U9kdw:45)
at ye (aVYNTJK5PuEMBYVX5U9kdw:41)
at Ae (aVYNTJK5PuEMBYVX5U9kdw:42)
at Fe (aVYNTJK5PuEMBYVX5U9kdw:48)
at Ke (aVYNTJK5PuEMBYVX5U9kdw:60)
at Vg (aVYNTJK5PuEMBYVX5U9kdw:60)
at Ie (aVYNTJK5PuEMBYVX5U9kdw:58)
at xh (aVYNTJK5PuEMBYVX5U9kdw:126)
I was working on a hole for a while and the page crashed after being stuck in an infinite loop while running, causing me to lose all of my work. It just defaulted back to an earlier, much worse solution.
What title says. Otherwise it's hard to track your progress.
Not sure if it's intentional, but reading 'a prime number that results in a different prime' in the description led me to believe that it might not be!
Static filter /^https?:\/\/[^/]+\/[a-z0-9]{15,}(\?hope=.*)?$/$script,domain=~coco.fr|~sap.com|~stumbleupon.com|~tv.yandex.by|~tv.yandex.kz|~tv.yandex.ru|~tv.yandex.ua
found in:
RUS: RU AdList
I guess the filter is too aggressive, but why do you have to use links like https://code-golf.io/6OQ9d0QseMIhQb08mXrD8Q
?
And hangs during the JS JSON encoding time.
I had this for Evil Numbers. If I take out any character in the string, it correctly says my results are wrong. If I take the initial null byte out of the string, and throw 0,
in front, it works (but one more character! 😖).
say for unpack"U*",'����
���������!"$\'(+-.0'
When trying the BF problem, my attempted solutions print only 1 line and nothing else. Trying the sample input in online BF interpreters also have similar issue - they print 1 line and the rest is garbled. Seems to me BF here makes some undocumented implications, like that memory cells are certain size (0-255 unsigned octets?! or what) or that the memory tape is invinite in right direction but stops at 0 on the left. Whatever the assumptions - that should be pointed out since not part of the BF "spec" (there is no ISO standard :) )
In the entry for letter U, the letter Y is displayed instead.
A bit like MediaWiki's random page functionality.
The Leaderboard is no long shown correctly when "All Holes" is selected
Seriously, you can't even read anything. I've played around with the CSS a little bit, but I can't see an easy fix. Possibly an upstream issue in FF or Chart.js?
Right now, the STDERR and STDOUT appear above the explanation after pressing Run. This is usually fine, but on long questions like the morse encoder/decoder you have to scroll a fair way to check it. Also, on some browsers like Chrome, the page will jump around as new elements appear and disappear, which is a bit distracting. This can be solved by placing the console output at the bottom of the page, below the code editor itself.
IMO not being able to look at other solutions is better (actually, I'm no longer sure), so I don't think there's a need to any dramatic changes. However, I still want to show off some of the perl 6 tricks, so maybe some solutions should become public under certain conditions?
For example, if some solution was 1st for 1 year, let's make it public? Maybe this way others will have a chance to beat it.
See also: https://irclog.perlgeek.de/perl6/2017-09-19#i_15187089
The website claims this is open source, but this repo needs a particular license.
For example, see https://code-golf.io/scores/%CF%80/all. The table is OK and you can filter by the language, but if you're looking at “All Langs” you can't see what language was used.
In “Spelling Numbers” the program is given 35 numbers but if there's something wrong it's really hard to see what exactly. A diff can help.
Running print(scriptArgs)
in https://code-golf.io/morse-decoder#javascript prints â–„
rather than ▄
.
Compiling Spidermonkey with JS_C_STRINGS_ARE_UTF8
doesn't seem to help https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_CStringsAreUTF8
Either find a way to make Spidermonkey handle UTF-8 ARGV or try V8/ChakraCore/something else
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.