Coder Social home page Coder Social logo

code-golf / code-golf Goto Github PK

View Code? Open in Web Editor NEW
1.1K 12.0 97.0 13.36 MB

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

Go 42.09% Shell 0.80% CSS 7.21% Dockerfile 9.39% C 4.87% HTML 9.79% Makefile 0.47% Raku 10.03% C# 1.48% F# 0.31% Nim 0.06% PLpgSQL 2.14% C++ 0.03% TypeScript 11.15% Perl 0.14% JavaScript 0.03%
hacktoberfest

code-golf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-golf's Issues

Create a local dev environment

  • Create a docker-compose.yml file, app & db
  • Have the db.sql be applied to the db container
  • Hack up TLS to work, probably needs a fake root cert being committed to the repo and added to browser
  • Add a README.md on how to run locally
  • App container will probably need to be privileged since it spawns its own containers

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.

Haskell quine invalid?

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

Add more entropy to brainfuck answers

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.

Incorrect placement on leaderboard

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)

How can i see my own solution?!

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)?

Explain Rule 110 more

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

stderr does not count?

It seems that the solution is correct even if there are some warnings in stderr. Is it supposed to be like this?

Morse encoder and decoder

Those holes both say that:

The space between words is seven units

However, it seems like the space between words is actually ten units.

Color coding

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

π and 𝑒 tasks are bound by performance

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 :)

Python Quine not validated correctly

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.

perl \r sequence

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;}

Time limit (perl 6/rakudo)

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.

Time Out Message

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 :( )

Test set for Pangram Grep is flawed

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).

Julia Language

Add Jullia programming language. It has many things for code golfing

Redesign the "hole" page

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.

TODO

  • Add a diff output view of STDOUT (#11)
  • Add Perl 6 syntax highlighting
  • Add prev/next/random hole button to the top right (#29)
  • Collapse unselected tabs down to just the logo to save space, expand on hover/selection.
  • Allow the hole description to be collapsed

DONE

  • Replace CodeMirror with CodeFlask
  • Move status below the code
  • Clearly show the different ARGV (#31)

More holes needed

This was mentioned in #2.

Maybe this ticket can be the place where we can discuss ideas for new holes.

Command-line arguments (ARGV) not properly separated

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.

python quine not accepted

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.

PHP Errors sent to STDOUT

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

Add language filter on the homepage.

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.

JS error when typing PHP tags

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<?

Screenshot:
js-error

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)

Please add some kind of auto-save feature!

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.

Emirp expects palindromic primes

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!

The website is not usable with µBlock (RU_AdList)

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?

Null byte causes successful test to fail

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'

Brainfuck problem needs more detail

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 :) )

Broken Leaderboard

The Leaderboard is no long shown correctly when "All Holes" is selected

Stats page looks terrible in Firefox

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?

Suggestion: Move code output to below editor

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.

Language request: J

I would like to see J added to the site.

For reference, here is the source with build instructions to obtain the executable jconsole. And to run it, you have to do jconsole [code_file] [args] < [input_file]

Looking at Other Solutions

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

Add a LICENSE file

The website claims this is open source, but this repo needs a particular license.

Wrong links in the user page

Some links are wrong in the user page. See example below:
codegolf

Here the list of the wrong links:

  • 12 Days of Christmas
  • 99 Bottles of Beers
  • Arabic to Roman
  • Brainfuck
  • Christmas Trees
  • Morse Decoder
  • Morse Encoder
  • Roman to Arabic
  • Sierpiński Triangle
  • Spelling Numbers

See a Diff for Failing Solutions

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.