#codegolf

2025-11-20

Код-гольф в Яндексе: как нерды развлекаются

Что такое код-гольф? Это соревнование, в котором надо решить задачу по программированию (как правило, несложную), используя наименьшее количество символов. Соревнование довольно известное. Можно поиграть, например, на одноимённом сайте , есть целая секция на CodinGame , иногда такие соревнования публикует kaggle , была такая секция на HackerRank (сейчас её я не нашёл). В чём особенность таких задач? Низкий порог входа: решение можно написать с мобильника и оно будет занимать 10 строк. Но при этом есть большая сложность: чтобы избавиться от какого-то символа, в этом соревновании приходится идти на такие ухищрения, что мама не горюй. Некоторые конструкции очень неочевидные. Временами мы развлекаемся таким форматом. В какой-то момент на внутренних ивентах подняли свою платформу для соревнований, а потом она протекла и на внешние конференции. Эта статья — смесь разбора задач и истории появления соревнования по код-гольфу на конференциях Яндекса. Про нас и кодгольф

habr.com/ru/companies/yandex/a

#C++ #codingolf #codegolf #python #разработка #занимательные_задачи

2025-11-07

Meet me and some at the assembly on this years in Hamburg!

We will present some historcial running machines patching, tinkering (with a as an ), and and workshops!

clacke: exhausted pixie dream boy 🇸🇪🇭🇰💙💛clacke@libranet.de
2025-10-14

I've been annoyed by my lack of a way to put "multi-line one-liner" python code into my bash code with reasonable indentation.

This discussion suggested a workaround: Make the first line `if 1:`, then you can indent all you like on the second line. Good enough for me!

discuss.python.org/t/allowing-…

#python #CodeGolf #PythonCodeGolf

KesieV NorimakiKesiev
2025-10-09

Yo Dawg! I heard you may want to a sized version of a minimal like . So you can poker while you poker.

More here: github.com/kesiev/baatato

Two overlaid poker cards: one showing instructions on how to play Baatato, a stripped-down version of Balatro, and the other with the game's full source code.
KesieV NorimakiKesiev
2025-10-07

It's time for a new thingie. is a 2KB reinterpretation of the iconic Poker-inspired deck-building game we all know!

Code here: github.com/kesiev/baatato
Play here: kesiev.com/baatato/index.html

(Resize your browser window to a square shape to see the full game screen. It should also be playable on portrait mobile devices.)

The Baatato game logo, that's a cheap spoof of the Balatro game logo.
Guillaume Endignouxgendx@infosec.exchange
2025-10-02

So I've been trying to code-golf a JS-free menu bar from my website. The <details> HTML tag proves very useful to have a JS-free foldable menu in mobile mode, however I still need to duplicate the whole menu for desktop mode as I couldn't lock <details> to the open state in desktop mode even with media queries.

The ::details-contents pseudo-element sounds promising though, let's see if it works! It's not widespread yet but just landed in Firefox 143: developer.mozilla.org/fr/docs/

My bar for stability is at least some time in Firefox ESR, so it won't make it to my website for a year or two. #HTML #CSS #CodeGolf #NoJavaScript

N-gated Hacker Newsngate
2025-09-28

🤦‍♂️ Welcome to the mystical land of branchless programming, where we for the thrill of turning C code into an indecipherable mess. 🤯 It's like code golf for masochists who enjoy watching CPUs hyperventilate from all the caffeine-induced optimizations! ☕️🔧
sanixdk.xyz/blogs/the-weird-co

Dethronatus Sapiens sp.dsilverz@calckey.world
2025-09-07

32-bit #NASM equivalent:

BITS 32
GLOBAL _start
SECTION .text
_start:
    dec esp
    dec ecx
    dec esp
    dec ecx
    push esp
    dec eax
    pop esp

    mov eax, 4
    mov ebx, 1
    mov ecx, nope
    mov edx, nope_len
    int 0x80

    xor eax, eax
    inc eax
    mov bl, 0
    int 0x80

SECTION .data
    nope: db "Nothing to see here...",10,0
    nope_len: equ $-nope

Make:
nasm -f elf32 -o program.o program.asm && ld -nostdlib -s -n -m elf_i386 -o program program.o

For those wondering what exactly is going on, the screenshot further explains and reveals it.

#steganography #hiddenmessage #assembly #code #asmcode #programming #codegolf #occult

Screenshot of a terminal depicting the output of multiple, sequential commands:

1. `make` invokes `rm program.o || true`, then `rm program || true`, then `nasm -f elf32 -o program.o program.asm && ld -nostdlib -s -n -m elf_1386 -o program program.o`
2. `./program; echo $?` outputs "Nothing to see here..." followed by 0 (success as exit code, so no crash, no segmentation fault, nothing wrong)
3. `objdump -S -F program` shows the disassembly of said program, together with file offsets, as well as its format `elf32-i386`.  The main section of machine code, `.text`, which starts at file offset 0x60, shows both the hexadecimal opcodes, as well as the Assembly instructions (which are practically those included in this post, with some differences such as `.nope` disassembling as a literal memory address instead of a label name). 
4. Finally, `hexdump -C -s 0x60 -n $((0x82 - 0x60)) program` shows what's really going on: you can see the name "LILITH" at the very beginning of the section `.text` (`4c 49 4c 49 54 48 ...`)
5. `strings program` further confirms it by listing "LILITH" as one of the valid ASCII strings inside the file.

In essence, a(n occult, Goddess/entity's) name was concealed as totally runnable machine instructions.
Dethronatus Sapiens sp.dsilverz@calckey.world
2025-09-02

Using #GNU as Assembler (not Assembly, but the Assembler) and ld Linker to spit out a working BMP gradient image.

Yeah, you read it right. I'm not using
#Assembly to produce an image. I'm, instead, using Assembler directives and macros during compile-time to generate a binary file that happens to be a valid image (BMP) file.

File: tonishing.s (GNU Assembly file)

width = 320
height = 240
area = width * height
_begin:
    .ascii "BM"
    .int fileSize
    .int 0
    .int (_rasterdata - .)

_infoheader:
    .int infoheaderSize
    .int width     # width
    .int height    # height
    .short 1       # planes
    .short 24      # bitcount
    .int 0         # compression
    .int 0         # imagesize
    .int 11811     # xpixperm
    .int 11811     # ypixperm
    .int 0         # colorsused
    .int 0         # colorsimp

infoheaderSize = (. - _infoheader)

_rasterdata:
    n=area+1
    .rept height
        .rept width
            byten=((n*255)/area)&0xFF
            rn=(192*byten)/255
            gn=(64*byten)/255
            bn=(128*byten)/255
            .byte rn,gn,bn
            n=(n-1)
        .endr
    .endr

fileSize = (. - _begin)

File: run.sh (Shellscript)
#!/bin/sh
clear
rm astonishing.bin
rm tonishing.o
as tonishing.s --64 -o tonishing.o
# The pun is _astonishingly_ intended.
strip -R .comment -R .note.gnu.property tonishing.o
ld -n -x -s -N --oformat binary --unique=.note.gnu.property -o astonishing.bin tonishing.o
magick identify -verbose astonishing.bin
I run the whole thing with... wait for it... #nodemon!

That's right: the tool intended for
#Nodejs hot-reloading, is being leveraged for GNU Assembly, which is itself being leveraged for compile-time instructions to produce a whole BMP image.
nodemon -e "s sh" --exec ./run.sh

While I have a
#Codeberg account, it's under my personal name where I published old projects from #GitHub, so I should do a second account for this pseudonym... but I'm not sure if this is against the Codeberg rules... So I'm posting the whole thing through a Calckey post instead.

#programming #devlog #dev #devhacks #quirks #codegolf #experiments #surreal #absurd

Screenshot of KDE Dolphin preview popup, showing information about the image that was just generated through GNU Assembler.

astonishing.bin
Type: Windows BMP image
Size: 225.1 KiB
Width: 320
Height: 240

The image is a purpleish gradient that goes from pure black, at the top, all the way to a purple tone at the bottom.Screenshot of KDE Dolphin showing a list of four files:

- tonishing.o: 225.5KiB, object code
- astonishing.bin: 225.1KiB, Windows BMP image
- tonishing.s: 790 B, plain text document (actually, it's GNU Assembly)
- run.sh:  368 B, shell scriptScreenshot of a terminal showing the following truncated output:

tonishing.s: Assembler messages:
tonishing.s: Warning: end of file not at end of a line; newline inserted
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400000
Image:
  Filename: astonishing.bin
  Format: BMP3 (Microsoft Windows bitmap image (V3))
  Class: DirectClass
  Geometry: 320x240+0+0
  Resolution: 118.11x118.11
  Print size: 2.70934x2.032
  Units: PixelsPerCentimeter
  Colorspace: sRGB
  Type: TrueColor
  Base type: Undefined
  Endianness: Undefined
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Pixels: 76800
    Red:
      min: 0  (0)
      max: 64 (0.25098)
      mean: 31.3777 (0.12305)
      median: 31 (0.121569)
      standard deviation: 18.4035 (0.0721705)
      kurtosis: -1.19998
      skewness: 0.000474742
      entropy: 0.996205
    Green:

Exactly 13 DAYS left to start #js13k 2025!

js13kgames.com

We've added first batch of this year's Partners, Experts, and Prizes to the website and will be announcing them all in the coming days.

#gamedev #gamejam #compo #competition #codegolf #challenge #JavaScript #HTML5 #indiedev #indiegames

js13kGames 2025 competition starts in: 13 days
2025-07-23

I kind of irrationally #CodeGolf my #Makefile rules, but sometimes I sit down to straighten out something awkward that bugged me for years, and get kind of mad when I seem to have been the first to actually treat `make` like the tool it is instead of as a broken shell script runner.

This time it was #Python #VirtualEnv setup:

```
dep: .venv/bin/pip .venv/lib/*/site-packages/__pycache__

.venv/lib/%/site-packages/__pycache__: .venv/bin/pip requirements.txt
.venv/bin/pip install -Ur requirements.txt

%/bin/pip:
/usr/bin/virtualenv $*
```

(Yeah pretend those are tabs. Yeah that is make's worst wart.)

I even use `!#.venv/bin/python3` in my scripts and hey presto everything just works everywhere and I can focus on the actual code.

I'm curious what cases I'm ignoring or missing here. Non-install upgrades may deserve a target perhaps...

Terence EdenEdent
2025-07-17

I'm submitting a "creepy" entry to this 1KB JS competition.

js1024.fun/

I've currently got 6 whole bytes spare. Wonder what I'll use them for?

2025-07-16

postcss-color-golf plugin 1.2.0 released!
github.com/xero/postcss-color-

rgb(255,0,0) → red
aliceblue → #f0f8ff
#aabbcc#abc;
rgba(255, 170, 187) → #fab
rgba(255, 170, 187, 0.8) → #fabcc
rgb(255, 255, 255, 1) → #fff
rgb(0, 255, 0, 0.8) → #0f0c
fuchsia → #f0f

#postcss #css #csstransforms #color #codegolf #golf #plugin

2025-07-01

js1024.fun/ is on

js 1k demo :)

golf well people

2025-06-24

every wanna golf your css color codes? yeah, me neither. just use my postcss plugin to do it for you
github.com/xero/postcss-color-

npmjs.com/package/postcss-colo

#npm #js #postcss #css #scss #sass #style #css3 #optomization #golf #codegolf

2025-06-09

Ich folge zu wenigen kreativen Accounts. Ich suche coole Software Spielereien, weniger klassische Kunst oder Hardware. Leute die Neues ausprobieren und Sachen aus Spaß programmieren, ohne konkrete Probleme damit lösen zu wollen. Code Golf, Experimente, ultra detaillierte Analysen und Deep-dives. Vorschläge? :BoostOK:

#codegolf #software #foss #creativity #noai

2025-05-16

rose quartz + DOF #glsl #generative #tinycode #codegolf
vec3 q=vec3(0,0,7e3),v=FC.rgb-r.xyx*.5,p,u=sin(FC.rgb*PI);v-=u*4.;for(float i,s;i++<67.;s=abs(2e3-length(p.yz))-3e1,q+=sin(i)+v*.7/r.x*s,o+=exp(-s*s/vec4(4,1,2,1))/i)for(p=q+u*4e4/r.x,s=7e3;9.<s;p=p.zxy+s*.02*sin(p/s*17.),s*=.8)p.zx*=rotate2D(s+(s==7e3?t*.2:0.));

2025-05-12

More #codegolf #programming - this time it's for some space invader animations. (140 characters was not enough to make the game interactive)

dwitter.net/d/33772

N-gated Hacker Newsngate
2025-05-10

✨ Behold the groundbreaking revelation: you can animate dots with simple math! 🤯 Code golfing has never been so exhilarating, or so... dotty. 🎯 Just when you thought life couldn't get simpler, here come the 16x16 dots to prove you wrong. 🎨✨
tixy.land

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst