r/codegolf • • Jan 07 '26

How many bytes does it take to print an arbitrary subset of 200 words from the wordle dictionary?

Thumbnail byte-heist.com
4 Upvotes

r/codegolf • • Dec 05 '25

Advent of Code: Day 5

4 Upvotes

Getting it out there, I'm a day behind so no golf from me on this one


r/codegolf • • Apr 17 '25

Can chatGPT code golf?

Thumbnail
youtu.be
4 Upvotes

I challenged myself and chatGPT to code golf a somewhat challenging render.


r/codegolf • • Oct 09 '24

Hosting Code Golf Contest

4 Upvotes

can anyone suggest any suitable platforms to host a code golf contest right now, ik about code.golf and anarchygolf


r/codegolf • • Nov 15 '23

9 code golf challenges: authorization

4 Upvotes

A logic game, similar to “Regex Golf”, that is designed to teach you authorization principles by completing permissions with as few objects as possible.

https://oso-golf.netlify.app/


r/codegolf • • Oct 13 '23

JS13K 2023 winning entries

Thumbnail
github.blog
4 Upvotes

r/codegolf • • Sep 11 '22

"Veritas" - TAS like visuals and Drum 'n' Bass in 256 bytes

Thumbnail
self.demoscene
4 Upvotes

r/codegolf • • Feb 18 '22

Interstate 128 - A 128 byte visual demonstration for the classic 1.7mhz 8bit Atari XE/XL (1st place at Lovebyte 2022 competition)

Thumbnail
pouet.net
4 Upvotes

r/codegolf • • Nov 25 '21

Any tips for javascript dom manipulation?

4 Upvotes

Like the title says, just trying to find ways of manipulating dom, such as creating elements, modifying them, etc. Wasn't sure who/where to ask.


r/codegolf • • Oct 05 '21

13 tiny and terrific entries from the js13kGames competition | The GitHub Blog

Thumbnail
github.blog
4 Upvotes

r/codegolf • • Sep 15 '21

Code Golf for Yesterday’s LC Daily

Thumbnail
gallery
4 Upvotes

r/codegolf • • Apr 03 '21

Dragon's Lair by Desire - 256 bytes intro for Msdos/FreeDos/WinXP/DosBox

Thumbnail
pouet.net
4 Upvotes

r/codegolf • • Mar 12 '21

Nano Award Show TODAY - 12.03.2021

Thumbnail self.tinycode
4 Upvotes

r/codegolf • • Dec 12 '20

Star Wars - Episode CCLVI - 256b intro for TIC-80

Thumbnail
self.tinycode
4 Upvotes

r/codegolf • • Dec 02 '20

Advent of Code Day 1

4 Upvotes

https://adventofcode.com/2020/day/1

The short version:

Part 1: find 2 numbers in a list that sum to 2020 and report the product of those numbers

Part 2: find 3 numbers in a list that sum to 2020 and report the product of those numbers


r/codegolf • • Oct 09 '18

Code golf for Brainheck multiplication and division

4 Upvotes

Okay, so this is two separate competitions. The first one is the code golf for Brainheck multiplication and division (Brainheck is Brainfuck but, it has the added command of ; as a halting command). The division cannot crash if the numbers don't evenly divide, and it has to output the remainder if there is one. We assume the inputs and the outputs are in numbers and not ascii.

The second one is not actually code golf, as it is not judged on the color of it's skin length of the code but on the content of their character number of move commands executed. So the goal of the second one is to have the least number of move commands actually executed for any given numbers to be multiplied. So if we were competing to add, [-<++++--->] would beat [-<><+->] even though it is longer because less move commands are executed.

My shortest without really trying (this is the first attempt) for multiplication is ,>,<[<->[->+>+<<]>[-<+>]<<]>>>. at 30 characters and I am still working on division


r/codegolf • • Jul 11 '18

[x-post /r/CoderTrials] Drawing The Sierpinski Carpet

4 Upvotes

Background

The Sierpinski Carpet is a plane fractal, made by repeatedly subdividing squares into 9 sub-squares, and removing the central square. The 3D counterpart to the sierpinski carpet is the menger sponge, made is a similar fashion. Being a fractal, you can repeat the process any number of times to produce an n-th generation of greater detail. Your objective here is to produce the n-th generation sierpinski carpet (seen as the face of a menger sponge), given n.

Input

A single number, n. For example:

1

Output

The nth generation sierpinski carpet. For the above, it would be:

###
# #
###

Testcases

===================================
0

#
===================================
1

###
# #
###
===================================
2

#########
# ## ## #
#########
###   ###
# #   # #
###   ###
#########
# ## ## #
#########
===================================
3

###########################
# ## ## ## ## ## ## ## ## #
###########################
###   ######   ######   ###
# #   # ## #   # ## #   # #
###   ######   ######   ###
###########################
# ## ## ## ## ## ## ## ## #
###########################
#########         #########
# ## ## #         # ## ## #
#########         #########
###   ###         ###   ###
# #   # #         # #   # #
###   ###         ###   ###
#########         #########
# ## ## #         # ## ## #
#########         #########
###########################
# ## ## ## ## ## ## ## ## #
###########################
###   ######   ######   ###
# #   # ## #   # ## #   # #
###   ######   ######   ###
###########################
# ## ## ## ## ## ## ## ## #
###########################
===================================

All characters count, switches count as characters, function args/return & stdin/stdout & command line args are all valid I/O. All languages allowed.

Also, sorry for the long testcases section. The code is formatted for CoderTrials CSS, so I actually had to drop a testcase to make it fit here. If you want to see the formatting or fourth level carpet, this is the original post.


r/codegolf • • Jan 25 '18

Collection of Shortest FizzBuzz Algorithms One-Liners in Ruby - The Winner is 56 Bytes

Thumbnail
github.com
4 Upvotes

r/codegolf • • Sep 18 '16

Contemplating a small esolang/codegolf conference in San Francisco (then elsewhere) [xpost r/esolangs]

4 Upvotes

I'm sitting at a conference on roguelike games right now and ran into some esolang users and it occurred to me that it wouldn't be hard to get a couple of hundred folks together with some presenters and challenges/contests and networking and education and such.

Would anyone around here be interested in collaborating on the first instance of this idea in San Francisco, probably in spring 2017? Or with an eye toward having a similar event elsewhere later?

Sign up for this mailing list if so: https://groups.google.com/d/forum/cnfrnc-organize


r/codegolf • • Jun 08 '16

Tiny Pi calculator - Fish Language

Thumbnail fishlanguage.com
4 Upvotes

r/codegolf • • Apr 17 '16

[Julia] [All] Tic Tac Toe

4 Upvotes

First attempt at code golf! I chose Julia because I like it and it allows declaring functions like you do in math (which I abused to reduce character counts, naturally). It also has a ternary operator which I abused to do conditional logic in few characters, and allows variables to be set to functions. Julia doesn't differentiate between semicolons and newlines, so I don't think those should matter but I am counting spaces. I also used some recursion to replace iteration because it took slightly fewer characters...

Characters: 412 (not counting comments)

b=zeros(3,3) # board is integers, -1 is O and 1 is X
p=println
s=slice
r(x)=x>0?"X":x<0?"O":" " # render spot on board
q(b,i)=i>9?"":"$(r(b[i]))$(r(b[i+1]))$(r(b[i+2]))\n"*q(b,i+3) # render board
f(A)=all([(i==A[1])&(i!=0)for i in A]) # check if all items in an array are equal and not 0
c(A,i)=i<1?false:A[i]==0?true:c(A,i-1) # check if there are open spaces on the board
d(A,n)=n>0?[A[i,i]for i=1:3]:[A[4-i,i]for i=1:3] # Check the diagonals of the board
w(b,i)=i<1?0:f(s(b,i,:))?b[1,i]:f(s(b,:,i))?b[i,1]:f(d(b,1))|f(d(b,0))?b[5]:w(b,i-1) # determines the current winner of the board, returns 0 if there isn't one
a=1 # a is the current player
while w(b,3)==0&c(b,9) p(q(b,1));b[parse(readline(STDIN))]=a;a=-a end # while the winner is 0 (no winner), change the board at the index given to the current player
p(q(b,1)) # print the board at the end

You play by entering the index (1..9) of the spot you want to play on. There are no checks so entering anything besides 1..9 will crash the program, and cheating is super easy. But it works!


r/codegolf • • Nov 26 '15

perl ASCII wave challenge

4 Upvotes

I'm trying to make this code for printing out an ascii wave to the terminal as short as possible. Can any perl monks help me out? Here is what I have so far.

$x="`'-.,_,.-'"x8;$|=1;for(;;){$y=substr$x,0,-1;print"$y\r";$x=(substr$x,-1).$y;sleep 1;}

r/codegolf • • May 21 '14

[bash] 99 bottles [all]

4 Upvotes

A fun classic, I decided to golf in bash. got it down to 375 characters

d(){ N=$1;S1=" of beer on the wall";S2="Take one down and pass it around";S3="Go to the shop and buy some more";b $N;echo -n "$S1, ";b $N;echo "${S1:0:8}.";N=$(($N-1));if [[ $N -lt 0 ]];then N=99;S2=$S3;Q=1;fi;echo -n "$S2, ";b $N;echo -e "$S1.\n";if [[ $Q != 1 ]];then d $N;fi;};b(){ case $1 in 1)S="1 bottle";;0)S="No more bottles";;*)S="$1 bottles";;esac;echo -n $S;};d 99

Here it is before I turned it into a one-liner

#!/bin/bash

drink() {

    N=$1
    S1=" of beer on the wall"
    S2="Take one down and pass it around"
    S3="Go to the shop and buy some more"

    bottles $N; echo -n "$S1, "
    bottles $N; echo "${S1:0:8}."
    N=$(($N-1))
    
    if [[ $N -lt 0 ]]; then
        N=99
        S2=$S3
        Q=1
    fi

    echo -n "$S2, "
    bottles $N; echo -e "$S1.\n"

    if [[ $Q != 1 ]]; then
        drink $N
    fi
    
}

bottles() {
    S=" bottles"
    case $1 in
        1) S="1${S:0:7}";;
        0) S="No more$S";;
        *) S="$1$S";;
    esac
    echo -n $S
}

drink 99

Additional challenge: golf it in under 140 so it's tweetable


r/codegolf • • Sep 10 '26

Most condensed version of snake in Pico-8

Thumbnail
lexaloffle.com
3 Upvotes