| name | correct guesses | games together | ratio |
|---|---|---|---|
| Olivia | 8 | 12 | 0.667 |
| SoundOfSpouting | 3 | 6 | 0.500 |
| LyricLy | 6 | 15 | 0.400 |
| Palaiologos | 3 | 8 | 0.375 |
| razetime | 4 | 12 | 0.333 |
| Olek Sabak | 1 | 4 | 0.250 |
| Edgex42 | 1 | 4 | 0.250 |
| IFcoltransG | 1 | 10 | 0.100 |
| Indigo | 0 | 5 | 0.000 |
| Olive | 0 | 6 | 0.000 |
| name | correct guesses | games together | ratio |
|---|---|---|---|
| Olek Sabak | 2 | 4 | 0.500 |
| Indigo | 1 | 5 | 0.200 |
| LyricLy | 3 | 15 | 0.200 |
| Olivia | 2 | 10 | 0.200 |
| Olive | 1 | 6 | 0.167 |
| Palaiologos | 1 | 8 | 0.125 |
| IFcoltransG | 1 | 8 | 0.125 |
| Edgex42 | 0 | 4 | 0.000 |
| razetime | 0 | 12 | 0.000 |
| SoundOfSpouting | 0 | 6 | 0.000 |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | $ let's make a text editor 1 step at a time. for our first task, we need to wrap words. submissions can be written in any language. $ $ word wrapping is often a necessary part of displaying words on a screen, especially when they need to stay in a particular area. it's probably a feature of every piece of software you've ever used that shows text (so, all of it). let me remind you what it is. $ $ text is generally taken to be a one-dimensional concept unless you're writing Befunge, but it's displayed on a two-dimensional surface. the thing about two dimensions is that it's like a lot of one-dimensional things pasted together, so it gives you more space in your space. it'd be more convenient if we could just print everything on paper and screens one em tall. we wouldn't need word wrapping then. but then books and screens would have to be very long, and you wouldn't be able to fit them through doorways very easily. so instead we have rectangles, and are resigned to cutting up text so it can fit: word wrapping. $ $ there are many technical details as to how one might implement this. but this is code guessing, where we don't care about them. at the minimum, I'll ask this: my brand new code guessing editor will target displays 80 columns wide. at the minimum, I should be able to wrap text for such a terminal. this is word wrapping, so I also ask that you not break up continuous series of letters. $ $ thank you. as any language is allowed, there is no fixed API. N ← 80 # whitespace arrays (w = p ∨ ¬s) ◡≥⊸⊃> =@ # idx of next whitespace (j) ↘1⍜⇌\↧+°⊏¯°ₑ˜⊂1 # index of wrapped start-of-line (k) # F k i j p s := k' F ← ⨬⊙⋅⋅⋅◌⋅⊙⋅⋅◌↥◡⊃(×>N-⊙⋅⊙◌)⋅⋅⋅= +1°⊏ # scan using F, k0=0 ⬚0\(F⊙°⊟₄)≡⊟₄ # group runs by same k ⊕□⊛ # strip whitespace around each line & print ⍚(&p▽×˙⍜⇌∩\↥⊸>@ ) |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | -- A good sequence tells a story. a = 0 n = 0 -- Ours is about the ups and downs of life. resilience = {} -- Look closely, and you can see the pattern. repeat -- It starts with the auctus of the familiar. resilience[a] = true -- Next is the mortifying ideal of being known. print(n, a) -- The stakes grow, ever so slowly. n = n + 1 -- They can make failure feel crushing. a = a - n -- But wisdom lets us avoid the mistakes of the past. if a < 0 or resilience[a] then -- Resilience means bouncing back and even reaching new heights. a = a + n + n end -- Until wisdom? until wisdom |
submitted at
4 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | bf p i = reverse (run 0 p [] [0] (reverse i) []) run 0 ('(':')':p) r (n:t) m a = run 0 p r ((n+1):t) m a run 0 ('[':']':p) r (n:t) m a = run 0 p r ((n+length m):t) m a run 0 ('{':'}':p) r (n:t) (x:m) a = run 0 p r ((n+x):t) m a run 0 ('{':'}':p) r t m a = run 0 p r t m a run 0 ('<':'>':p) r t m a = run 0 p r t a m run 0 ('(':p) r t m a = run 0 p r (0:t) m a run 0 ('[':p) r t m a = run 0 p r (0:t) m a run o ('{':p) r t m a = run (o+1) p (p:r) (0:t) m a run 0 ('<':p) r t m a = run 0 p r (0:t) m a run 0 (')':p) r (x:n:t) m a = run 0 p r ((n+x):t) (x:m) a run 0 (']':p) r (x:n:t) m a = run 0 p r ((n-x):t) m a run 0 ('>':p) r (_:t) m a = run 0 p r t m a run 0 ('}':p) (_:r) (x:n:t) (0:m) a = run 0 p r ((n+x):t) (0:m) a run 0 ('}':_) (p:r) t m a = run 0 p (p:r) t m a run 1 ('}':p) r t m a = run 0 ('}':p) r t m a run o ('}':p) (_:r) (_:t) m a = run (o-1) p r t m a run o (_:p) r t m a = run o p r t m a run _ [] _ _ m _ = m |
submitted at
1 like
1 | entry = lambda terrain: sum("".join(" #"[e > h] for e in terrain).strip().count(" ") for h in range(max(terrain))) |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | module WhyWastePerfectlyGoodGraphAlgorithmsThatAreAlreadyBuiltIntoTheRuntime (entry) where import System.IO.Unsafe import System.Mem import System.Mem.Weak import Data.IORef import Data.Maybe import Control.Monad data Node = Node { children :: IORef [Node], parents :: IORef [Weak Node], idx :: Int } mark :: [[Bool]] -> Int -> Int -> IO (Node, Node) sweep :: [Int] -> (Node, Node) -> IO [Int] entry :: [[Bool]] -> Int -> Int -> [Int] mark matrix start end = do nodes <- sequence [Node <$> newIORef [] <*> newIORef [] <*> pure i | i <- [0..n-1]] forM (zip [0..] matrix) $ \(i_from, row) -> forM (zip [0..] row) $ \(i_to, c) -> when c $ let node_from = nodes !! i_from node_to = nodes !! i_to in do node_from_ref <- mkWeakPtr node_from Nothing modifyIORef' (children node_from) (node_to :) modifyIORef' (parents node_to) (node_from_ref :) return (nodes !! start, nodes !! end) -- ___ where n = length matrix -- _____#_#_____ -- | | | | | | sweep path (start, end) -- | | | | | | | idx start == idx end = return path' -- | | | | | | | otherwise = do -- | | | | | | writeIORef (children end) [] -- | | | | | | performGC -- \| | | |/ reachable <- readIORef (parents end) -- |_|_|_| >>= mapM deRefWeak sweep path' (start, last (catMaybes reachable)) where path' = idx end : path entry m start end = unsafePerformIO $ do mark m start end >>= sweep [] |
submitted at
1 like
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | type bool = Boolean; function entry(grid: bool[][], x: number, y: number): bool[][] { if (!Number.isInteger(y)) throw "y coordinate must be an integer"; if (!Number.isInteger(x)) throw "x coordinate must be an integer"; var height = grid.length; if (y < 0) throw "y coordinate must not be negative"; if (y >= height) throw "y coordinate is too large for grid"; var width = grid[0].length; for (var i = 1; i < height; i++) if (grid[i].length != width) throw "grid rows have inconsistent widths"; if (x < 0) throw "x coordinate must not be negative"; if (x >= width) throw "x coordinate is too large for grid"; for (var i = 0; i < height; i++) for (var j = i + 1; j < height; j++) if (grid[i] == grid[j] && (grid[i] = [...grid[j]])) continue; var next_x, next_y = []; // Handle x coordinate flood fill while (next_x) { if (grid[x] && height > y > 0 && !grid[x][y]) { grid[x][y] = true; if (x) next_x.push(x - 1, y); next_x.push(x + 1, y); if (y) next_x.push(x, y - 1); next_x.push(x, y + 1); } else if (!next_x.length) break; y = next_x.pop(); x = next_x.pop(); } // Handle y coordinate flood fill while (next_y) { if (grid[y] && width > x > 0 && !grid[y][x]) { grid[y][x] = true; if (x) next_y.push(x - 1, y); next_y.push(x + 1, y); if (y) next_y.push(x, y - 1); next_y.push(x, y + 1); } else if (!next_y.length) return grid; y = next_y.pop(); x = next_y.pop(); } return grid; } |
submitted at
0 likes
1 2 | # boring chalenge unlink($0);#;($0)unlink |
submitted at
2 likes
1 2 3 4 | 12[:5f/+2/&:/12/+:(2,0r[:r:uy:*`o+]; (the error correction term: 0)((((() ()()()){}){}()){}))/-:1%-uf0I`2/*f]; (Requires a Ly interpreter that does arbitrary precision.) |
submitted at
2 likes
1 2 | v=a=>a.length-1?[v(a[1]),v(a[0])]:a entry=s=>JSON.stringify(v(JSON.parse(s))) |
4 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | sub entry($x,$y) {if (2) {if (6) {}else {{5;}};say 6.^clone,6.^slip;};my $d:Array[Int]=2**$x[9]-$y; # 100
my $k:Array[Int]=7.^pairs;say @d-$k/1;if ($d) {}else{if (9) {if (7,$k*$k) {{my$x=$d;say $k*$k/
0.pairs;{if (0) {{my$c:Array[Int]=$k[1];}}else{9;}{$k;if($d**$d) {my$hw=$d;}if ($k.^invert) {if(
1) {}else{my$ze=$x;$d,$x;say $hw;my $glr:Int=9;if(9) {{$d;}}if (8) {say $hw;if(0.^pairs) {}else
{if (7) {say $hw;}else{say $d;{say $hw;if ($glr) {my$j=$k;}else{my$xde=$x;my$ay:Int=$hw+$c+
0.^invert,7.pairs.invert.^push;my $tfl:Int=0;}if(0-8) {say 9;}else{my $agy=$agy/$hw;}if ($d)
{{{$xde*$j**0.pairs/$ay;}my $oa:Int=1/$xde.^push[$hw];my$p:Array[Int]=$j;my $rd=4;{say 3;$c;}
my$jei=6**7.^slip.clone.push/7;say *;say $j+$c-$c,6+4+4/$xde/$d**0*$x;if ($jei) {say $c/**+
$hw.^slip.invert;my $rt:Array[Int]=5;}else {if ($d) {my$u:Int=4;if ($hw) {}else {0.^clone;}
if ($p) {if (3) {say $oa;}else{}}if($tfl) {{0;}}say $j*8;my $gtd=$x;}}if (8) {my$y:Array
[Int]=4-$oa**$j;if(3) {my$aba:Int=1;}else{say 5;my $yju:Array[Int]=8[1,$x];}}{my$alf=$k; # 90
say ($ay**2)+$xde-3**$rd;8;if(0,3/6*3/4-$x.^shift-9*$aba.shift*$rt*$glr.^pop) {if($yju){
# "this is not even valid raku syntax.", they said
# "there's more than one way to do it", they said
# "the author should be disqualified", they said
# "it's against the spirit of CGing", they said
}else {my $qp:Int=5;{my$di=$y;say $yju*6;}}}}my $v:Array[Int]=7;{say $ze;if($j.push) {
my $wf:Array[Int]=$agy;3**(8);say 6[$hw];if (7) {if(1**1) {$ze;}else{{if (1) {say $rt;
}else{if(7) {$ze;}else {}say 1,6;}}}}}else {{7,$ay+7;}}}}if($j/0+$qp+$glr.^pop) {}if
($rt) {say 5*$d;}else{my $uvs=$c[9].^slip.^push-1;}my$yh:Array[Int]=9*9;say 5;}my $w
=$u/3.^slip;my $e:Int=1,0*1;}{{my$yay:Int=1;}}say $ay;}my$xxx=$rt;}$p;{my$gac=$k;}}
else{my$ji:Int=$xxx;{if (9) {say $aba;{if($yh) {if (4) {my $uhv=$jei**3[6[$oa],
2.invert.^invert].^pop;}}}say $e;say 9-2;say $ze;my $r=1;say 4;}else {my $t:Int=
0.^pop;if ($rd+8) {$uvs;}}}}say 3;if($jei) {if($ji) {if($yh**$xxx) {{$p,$yh/0[0]
;say $uhv,1*$di,6;}}else {}}else {my $alv:Array[Int]=$uvs+$hw,3**0.clone;}say # 80
$agy.slip**4,$w[$k].^clone;}if($d) {"j!ipqf!tif!epfto(u!usz!up!uftu!ju";if(
$tfl*0) {say $v**$uhv-$e+2.invert,1;}else {if(7) {{}my $pab=$xxx;}else {{if
(5.^push) {my $o:Array[Int]=*;say $xde;my$xgl=1;say $rd;if ($glr-8.slip) {
say $u;say 4;my $fc=$fc;say 8;}else {my $qoj=2;}if($gtd**$x.^slip[$qoj**8
.^shift]) {my $mlx=0-4.^invert;my$ps:Array[Int]=8;}my $qpb=$o;say 9[$j-$ze
+$v.shift***];say 2;}else{{say 0*5*3/0;}}}}}}else {say 0;}my $lcc=$o;say
6[$gtd,$qpb]-8*9/0[1];}my $zqe:Int=$di;my$rc:Int=$qoj*9,$c;if ($aba) {my
$jvq:Int=5;}else{{if ($gtd) {{if ($hw*$rd) {5+$t;}else{say 5;}}}}}say 1
-5,2;if($ay) {}}else{}}my$hes=$alf;}}}else{say $d;}}}}
|
submitted at
3 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import ctypes , pathlib def entry (xs, ys): return xs + xs + '/' + xs + '.' + ys def pathlib (f) : import pathlib \ ; pathlib = ctypes.CDLL (next (q \ for f in pathlib.Path (entry ('.', '/')).glob (entry ('*', 'c')) \ if 'double entry' in open (f).read () and (q := f.with_name ('a.out')).is_file ())).entry \ ; ctypés = ctypes.c_double; return lambda *z: f (ctypés, pathlib, len, *z) \ , @pathlib def pathlib (pathlib, ctypes, len, xs, ys): ctypes.restype = pathlib \ ; len = (len(ys) + len(xs)) // 2 \ ; return ctypes ((pathlib *len) (*xs) , (pathlib *len) (*ys), len) \ entry ,= pathlib del ctypes , pathlib '~ needs C, compiled, -sharedLy, as a library ~' |
impersonating BeatButton
1 2 3 4 5 6 | pub fn entry(input: &str) -> i32 { // "eval" builtins make the problem trivial std::fs::write("/tmp/eval.rs", format!("fn main() {{ print!(\"{{}}\", {}); }}", input)).unwrap(); std::process::Command::new("rustc").args(["/tmp/eval.rs", "-o", "/tmp/eval"]).status().unwrap(); std::str::from_utf8(&std::process::Command::new("/tmp/eval").output().unwrap().stdout).unwrap().parse().unwrap() } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | class BrainfuckProgram: def __init__(self, code, ip, tape, memory, input, output): self.code = code self.ip = ip self.tape = tape self.memory = memory self.input = input self.output = output def instruction(self): self.ip += 1 match = 1 if self.code[self.ip] == "+": self.tape[self.memory] += 1 if self.tape[self.memory] == 256: self.tape[self.memory] = 0 if self.code[self.ip] == "-": self.tape[self.memory] -= 1 if self.tape[self.memory] == 0: self.tape[self.memory] = 256 if self.code[self.ip] == "[": match = 1 if self.tape[self.memory] == 0: while match > 0: self.ip += 1 if self.code[self.ip] == "]": match -= 1 elif self.code[self.ip] == "[": match += 1 if self.code[self.ip] == "]": match = 1 if self.tape[self.memory] != 0: while match > 0: self.ip -= 1 if self.code[self.ip] == "[": match -= 1 elif self.code[self.ip] == "]": match += 1 if self.code[self.ip] == "<": self.memory += 1 if self.code[self.ip] == ">": self.memory -= 1 if self.code[self.ip] == ",": self.code[self.ip] == 0 self.input = True if self.code[self.ip] == ".": self.output += bytes([self.tape[self.memory]]) def decompress(code): program = BrainfuckProgram(code, 0, [0]*30000, 0, b"", b"") while True: try: program.instruction() except: return program.output def code(n): program = "" i = 0 while n > 0: n -= 1 program += chr(n % 256) n //= 256 return program def compress(text): programs = [] i = 0 while True: for program in programs: try: if program.halted: program.instruction() except: if program.output == text: return program.code else: program.halted = False programs.append(BrainfuckProgram(code(i), 0, [0]*30000, 0, b"", b"")) programs[len(programs) - 1].halted = True i += 1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | // By performing only simple operations, // the program's behavior becomes obvious. // Simple code is "suggestive and readable". char *s, *o, *m, *e, *b, *od, y[2], *on; ce; char *pump(char a) { if (!a) return b = e = m = 0; else if (!m) { on = o; s = od; m = on; a = 1; } else if (*y == 2) { if (s) o = 0; else s = y + 1; od = o; e = s; a = 1; } else if (on[ce]) on++; else if (b) if (m == on) ce = a = 0; else { b = 0; on--; ce++; e = s; } else if (!e) a++; else if (!*e) b = o = on; else if (*e == on[e - s]) e++; else b = m; y[!a] = a; return pump(a); } char *entry(const char *hays, const char *need) { o = need; pump(*need); o = hays; pump(*need); return o; } |
post a comment