14 votes

ASCII Bookshelves

JavaScript (ES6), 100 99 98 bytes Takes the width w and the number of books b in currying syntax ...
Arnauld's user avatar
  • 192k
14 votes

Placing circles along a square spiral

JavaScript (ES7),  319  309 bytes Expects (g)(k) and returns [x,y]. The formula for the spiral coordinates was inspired by this ...
Arnauld's user avatar
  • 192k
14 votes

Placing circles along a square spiral

JavaScript (ES2020), 417 338 331 323 321 318 316 304 303 290 283 273 269 261 257 252 247 244 237 234 238 234 207 206 205 200 194 193 186 182 183 182 bytes ...
emanresu A's user avatar
  • 37.8k
10 votes
Accepted

Find the area of the smallest rectangle to contain squares of sizes up to n

JavaScript (ES6), 172 bytes Slower but shorter version suggestion suggested by @JonathanAllan (also saving 4 bytes in the original answer): ...
Arnauld's user avatar
  • 192k
9 votes

ASCII Bookshelves

Bash (+utilities), 130, 108, 106 bytes A single, continuous, shell pipeline to render your bookshelves. Changelog: Optimized first sed expression a bit, -12 bytes (Thx @Riley !) Replaced ...
zeppelin's user avatar
  • 8,486
9 votes

Packing Cuboid Boxes into the Shortest Stretchy Truck

Ruby, 292... 228 bytes ...
G B's user avatar
  • 21.9k
8 votes
Accepted

Placing circles along a square spiral

JavaScript (Node.js), 211 bytes ...
tsh's user avatar
  • 34.7k
8 votes
Accepted

Compute the polyomino capacity of a rectangle

Python 2, 53 bytes lambda p,q,n:p/n*q+q/n*(p%n)-min(0,n-p%n-q%n)*(p>n<q) Adapts the formula given in this paper, which is: ...
xnor's user avatar
  • 145k
6 votes

ASCII Bookshelves

Batch, 261 bytes ...
Neil's user avatar
  • 170k
6 votes

ASCII Bookshelves

Python 2, 133 113 105 bytes I'm sure there's a better way... ...
hyper-neutrino's user avatar
  • 42.4k
5 votes

CGAC2022 Day 21: Present stack headache

Python 3, 130 bytes lambda W,L,H,a:sum(0<=(H:=H-i)for i in sorted(min(h+H*(w>W or l>L)for h,w,l in permutations(b))for b in a));from itertools import* ...
tsh's user avatar
  • 34.7k
5 votes

ASCII Bookshelves

Haskell, 100 bytes x#y returns the string for width x and y books. ...
Ørjan Johansen's user avatar
5 votes

Do the figures fit?

Python 2, 529 692 683 681 bytes ...
TFeld's user avatar
  • 19.8k
5 votes

ASCII Bookshelves

PowerShell, 149 134 bytes param($w,$b)$s="|$('-'*$w*3)|" if($a=$b%$w){,$s+,"|$('|X|'*$a)$(' '*3*($w-$a))|"*3+$s} if($b-=$a){(,$s+,"|$('|X|'*$w)|"*3+$s)*($b/$w)} ...
AdmBorkBork's user avatar
  • 43.4k
4 votes

ASCII Bookshelves

CJam, 62 61 bytes q~1a*W$/W$f{0e]}{{"|X|"S3*?}%s__'-3*W$*_}%1m>W%"| |"*"||"\*o; Takes input as width books Try it online! ...
Business Cat's user avatar
  • 9,167
4 votes

ASCII Bookshelves

Python 3, 142 bytes Still working on it. b is for 'number of books' and w is for shelf width. ...
Juan Meleiro's user avatar
3 votes

ASCII Bookshelves

Java 7, 230 224 222 bytes ...
Kevin Cruijssen's user avatar
3 votes

CGAC2022 Day 21: Present stack headache

Python3, 217 bytes: ...
Ajax1234's user avatar
  • 7,131
3 votes

Packing Cuboid Boxes into the Shortest Stretchy Truck

Jelly, 44 bytes _⁹żAƑƇŻ€,Œp€+þ@/ʋ/€Ẏ Œ!€⁹,1W;"çⱮ/pẎ€QƑƇɗ/ʋ1# Try it online! A dyadic pair of links taking a list of boxes as the left argument and the truck’s ...
Nick Kennedy's user avatar
  • 21.1k
3 votes

ASCII Bookshelves

AHK, 208 bytes ...
Engineer Toast's user avatar
3 votes

CGAC2022 Day 22: Present stack headache, Part 2

Python 3, 180 bytes ...
tsh's user avatar
  • 34.7k
3 votes

CGAC2022 Day 22: Present stack headache, Part 2

JavaScript (Node.js)*, 153 bytes * This code relies on a specific implementation of sort(). The engine used on TIO is Node 11.6.0. This was also succesfully tested ...
Arnauld's user avatar
  • 192k
2 votes

Do the figures fit?

Wolfram Language (Mathematica), 811 bytes ...
Keyu Gan's user avatar
  • 2,153
2 votes

Tetris Tangrams

Python 3, 819 bytes, M=0, Score=181 This is a brute force DFS program. It builds a numpy array, and inserts all the inputted holes. It then takes the leftmost unfilled tile on the highest row that ...
Vedvart1's user avatar
  • 179
2 votes
Accepted

Tiling the unit square

Haskell, 263 262 bytes ...
halfflat's user avatar
  • 261
2 votes

CGAC2022 Day 21: Present stack headache

JavaScript (Node.js)*, 128 bytes * This code relies on a specific implementation of sort(). The engine used on TIO is Node 11.6.0. This was also succesfully tested ...
Arnauld's user avatar
  • 192k
2 votes

CGAC2022 Day 21: Present stack headache

Charcoal, 72 bytes Fθ«≔E³E³§ι⁺κμι≔Φ⁺ιEι⮌κ⬤꬛μ§ηνι¿ι⊞υ⌊Eι⊟κ»≔⟦⟧ζW⁻υζF№υ⌊ι⊞ζ⌊ιILΦ欛Ӆζ⊕κ↨η⁰ Try it online! Link is to verbose version of code. Explanation: ...
Neil's user avatar
  • 170k
2 votes

ASCII Bookshelves

PowerShell, 109 bytes param($w,$b)for(;$b;$b-=$c){if(!($c=$b%$w)){$c=$w}($l="|$('-'*$w*3)|") ,"|$('|X|'*$c)$(' '*($w-$c)*3)|"*3 $l} Less golfed test script: <...
mazzy's user avatar
  • 7,085
2 votes

CGAC2022 Day 21: Present stack headache

05AB1E, 21 bytes εœʒ@¨P}€θß}²Oª{ηÅΔO‹θ Try it online! +2 bytes: fixed a bug found by Jonathan Allan Assumes that all chimney dimensions are positive. ...
AndrovT's user avatar
  • 2,796
1 vote

CGAC2022 Day 22: Present stack headache, Part 2

Python3, 221 bytes: ...
Ajax1234's user avatar
  • 7,131

Only top scored, non community-wiki answers of a minimum length are eligible