JavaScript piano one-liner :) #codegolf
for(p='',y=5;y--;p+="\n")for(x=80;x--;)p+=x&1?5-y<4*((59&(1<<((x>>1)%7)))>0)|0?'#':'|':' ';console.log(p)
JavaScript piano one-liner :) #codegolf
for(p='',y=5;y--;p+="\n")for(x=80;x--;)p+=x&1?5-y<4*((59&(1<<((x>>1)%7)))>0)|0?'#':'|':' ';console.log(p)
Simplest way to draw HAKMEM 149 based structure without offsetting / adjusting the seeds, turns out that using one unsigned shift is the
Loop is optional.
Two versions for the two different algorithm precisions. Adapted for 512x512.
Code is for a grey scale one but i made a colored one based on exponentially mapped iteration count (classic way to color fractals), this somehow require to offset coordinates for nice colors.
I have succeeded in creating a polyphonic #WebAudio soundscape, with 140 characters.
So proud/not proud with the cheats needed to get this code down to size.
Doing some table generation in awk, and is there an easier way to do "all fields n to NF" than this?
function combine(combn, combs) {
for (; combn<=NF; ++combn) {
combs=combs "\t" $(combn)
}
return combs
}
I could use printf on the fragments, but the annoyance is that loop, instead of
(string-join (cddr fields) "\t")
or whatever.
More golf!
194 bytes of code, which compresses to 140.
I have significantly better looking versions, but I need an extra 9 bytes to do it!
FWIW, that image shows the output of a real-time pixel shader, written in 171 bytes of #javascript
This feels like a good game for #codegolf - writing compact solvers for it - brute force is OK but I'm also curious about better solutions
Another #CodeGolf puzzle for #JavaScript #WebDev people:
I have n functions that type one argument of the same type and return a boolean.
The current usage is:
function a(b) {
return c(b) && d(b)
}
I boiled down a to
a = (b) => [c, d].every(fn => fn(x))
I assume, this can be further boiled down via bind/ #PartialApplication/ #Currying
What do you think?
The Art of Code Golf: Mastering the Shortest Path to Programming Prowess
Code golf has emerged as a unique blend of competition and creativity within the software development community, challenging programmers to condense their code into the shortest possible form. This ar...
https://news.lavx.hu/article/the-art-of-code-golf-mastering-the-shortest-path-to-programming-prowess
#lispygopherclimate https://archives.anonradio.net/202501220000_screwtape.mp3 #archive
#ClimateCrisis haiku/wildfires by @kentpitman
Electric (guitar) #music by @ksaj, community message from @TheGibson
Arrokoth #McClim Graphical adventure Game creation system #lisp
by five decade #gamedev veteran @mdhughes
#NUD #codegolf / adopting Arrokoth
@baruchel #lisp destructive permutation
#mastobook club - Snow crash
#livechat in #lambdaMOO
telnet lambda.moo.mud.org 8888
co guest
@join screwtape
#NUD #codegolf #programming #gamedev #commonlisp
If you'll forgive the daily throwaway challenges, here's another one. To quote from the link,:
```
'(a (b c) d (e f))
overwrite the b with the f.
```
My solution, featuring the new "apply nconc to register", &
```
(progn ^^ [ >> >> v [ & ^^ [ >> >> ] )
```
the ability to use & to create portals opens up a world of puzzles/golf challenges.
https://lispy-gopher-show.itch.io/lispmoo2/devlog/872152/nud-golf-2-more-nconc
I'll add @mdhughes' https://mdhughes.tech/software/arrokoth/ for the interface this week.
1D cellular automaton in 133 bytes of code!
https://www.dwitter.net/d/33092
this.r??=1;s=10;j=1;for(n=i=0;i<32;j*=2)(j&r)&&x.fillRect(i*s,t*600,s,s),n|=126&1<<((r&1<<++i?4:0)|(r&j?2:0)|(r&1<<i+30?1:0))?j:0;r=n
#gameDev
#codeGolf is a #game right?? "Challenges" and all that. #programmingChallenge #programming
https://lispy-gopher-show.itch.io/lispmoo2/devlog/871475/nud-golf
I modified my little NUD language to basically be vi but for #lisp lists. Er, if I do say so. YMMV
Alternately, propose your own challenges for me and others to solve (I'll add them to the git here: https://codeberg.org/tfw/nud/src/branch/master/golf.org )
If anyone wants help trying or has other commentary, lmk here or during the show.
A tiny way to compute a square / triangle wave at the same time without conditionals, only basic arithmetic and shifts.
This can be used for #oscillators or animations etc. #algorithm is a variant of HAKMEM 149.
Can also be used to draw a square. (And other shapes, see previous toot)
Code also shows how to draw a diamond shape by rotating the square by 45°.
There are two versions, optimized for size and optimized for speed.
I've finished and released the #interpreter for my new esoteric #programminglanguage , Bespoke!
https://github.com/WinslowJosiah/bespokelang
I've also been having lots of fun trying to solve #programming challenges with it, including #codegolf challenges.
After a large community effort, Code Golf (https://code.golf/) now supports unrestricted execution and answer checking for their growing list of problems in #APL (Dyalog APL). APL is listed in the "experimental" section of the supported languages list – once a sufficient number of people have submitted solutions, it will move to the main list of languages and get a leaderboard. Please help APL achieve this by exploring the site and submitting APL solutions. #Dyalog #DyalogAPL #CodeGolf
(@farty · Sep 9, 2018)
cls(8)q=sspr
r=rectfill
?"keepcalm andpico-8",8,0,7
memcpy(0x0,0x6000,4000)
p=16
::_::cls()
r(10,0,117,127,8)
circ(62,10,4,7)
q( 8,0,p,5,32,20,64,20)
q(24,0,p,5,32,44,64,20)
q(40,0,p,5,36,73,48,10)
q(56,0,24,5,18,92,72+24,20)
flip()goto _
https://pico-8-edu.com/?c=AHB4YQDuALw3H-8G27esP8FFVfAEbzBSRMXp7SMcf38ehJdd8AJlEKfHh09wQ-MGD9DV4SMctJMflBQ3Fadt9AtFGr-EWPkSRVokxyVB0Nxmgr24XLssjM4LXqAIVEW6ZrDuFALaIphIkuOaZiQMJ4bSJK3T0hcDRZumm_GapMhEd15xXpsUK0ldu8A3UeF7BIHvEUS_baI6S6qFZMJXZeeLMjNGlGX3VUmZXFdoia1uzvQLI4_wuFusbAE=&g=w-w-w-w1HQHw-w2Xw-w3Xw-w2HQH
#Pico8 #TweetCart
Python oneliner: add random diacritics to vowels. The input is "SEQUOIA sequoia". Prints e.g. "SÉQÜÕÏÁ sëqûôìâ".
import random;print("".join((chr(ord(c)&32|b"aimsz"["AEIOUaeiou".find(c)%5]+random.randint(95,98))if c in"AEIOUaeiou"else c)for c in"SEQUOIA sequoia"))
Edit: deleted the old versions because they might give away how the program works.
#Python #codeGolf
FFmpeg boasts up to a 94x performance increase using hand written assembly!
Via TomsHardware:
"The benchmarking results show that the new handwritten AVX-512 code path performs considerably faster than other implementations, including baseline C code and lower SIMD instruction sets like AVX2 and SSE3. In some cases, the revamped AVX-512 codepath achieves a speedup of nearly 94 times over the baseline, highlighting the efficiency of hand-optimized assembly code for AVX-512.
This development is particularly valuable for users running on high-performance, AVX-512-capable hardware, enabling them to process media content far more efficiently. There is an issue, though: Intel disabled AVX-512 for its Core 12th, 13th, and 14th Generations of Core processors, leaving owners of these CPUs without them. On the other hand, AMD's Ryzen 9000-series CPUs feature a fully-enabled AVX-512 FPU so the owners of these processors can take advantage of the FFmpeg achievement."