name | correct guesses | games together | ratio |
---|---|---|---|
kimapr | 3 | 5 | 0.600 |
Makefile_dot_in | 2 | 5 | 0.400 |
LyricLy | 2 | 5 | 0.400 |
yeti | 1 | 5 | 0.200 |
Dolphy | 1 | 6 | 0.167 |
ponydork | 0 | 4 | 0.000 |
oleander | 0 | 6 | 0.000 |
Olivia | 0 | 4 | 0.000 |
name | correct guesses | games together | ratio |
---|---|---|---|
LyricLy | 3 | 5 | 0.600 |
kimapr | 2 | 4 | 0.500 |
Dolphy | 2 | 6 | 0.333 |
Olivia | 1 | 4 | 0.250 |
Makefile_dot_in | 1 | 5 | 0.200 |
oleander | 1 | 6 | 0.167 |
ponydork | 0 | 4 | 0.000 |
yeti | 0 | 4 | 0.000 |
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | clamp:{y max x min z}; lerp:{1-x*y+(x*z)}; stiffness:0.3; G:love.graphics; SIZE:[G.getWidth(), G.getHeight()]; newball: { pos: 2! map {math.random(SIZE x)}; rad: math.random(30,75); col: 3! map {math.random()}; [pos:pos,old:pos,rad:rad,col:col] }; balls: 20! map newball; bound:{clamp([0,0]+x.rad, x.pos, SIZE-x.rad)}; verlet: { accel: x; dt: y; new: accel*dt*dt - z.old + (2*z.pos); set(z,.old,z.pos); set(z,.pos,new); }; set(love, .draw, callable { G.clear(1,1,1); G.setColor(0,1,0); f:{G.circle(y,x.pos 0,x.pos 1, x.rad)}; balls map { G.setColor(x.col); f(x,.fill); G.setColor(0,0,0); f(x,.line); }; }); hypot:{x*x sum @math.sqrt}; norm:{h:hypot x;0~h?x*0:x/h}; step: { balls map { set(x, .pos, lerp(stiffness, x.pos, bound x)); }; 3! map { news: balls map { ball: x; deltas: (balls flip).pos map {x-(ball.pos)}- ; dists: deltas map hypot; dirs: deltas map norm; radsums: (balls flip).rad map {ball.rad+x}; overlaps: dists - radsums -; moves: overlaps > 0.001 * stiffness * dirs * overlaps; move: moves sum; x.pos + move }}; [balls,news] flip map {set(x 0, .pos, x 1)}; call(love.mouse.isDown,1) ? set(balls 0, .pos, [love.mouse.getX(),love.mouse.getY()]) : 0; balls map { verlet([0,1000], 1/60, x) }; }; set(love, .update, callable step); |
1 | function love.conf(t) t.window.title="cg81" end |
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | local ok,pprint = pcall(require, 'pprint') if not ok then pprint=print pformat=tostring -- that's all you deserve else pformat=pprint.pformat pprint.setup{show_all=true,use_tostring=true} end local lpeg = require 'lpeg' local P,V,R,C,Ct,Cc = lpeg.P,lpeg.V,lpeg.R,lpeg.C,lpeg.Ct,lpeg.Cc local function isty(ty,x) return type(x) == 'table' and x.ty == ty end local function enty(ty) return function(x) x.ty=ty return x end end local function inty(ty) return function(x) return {ty=ty,x} end end local list = enty'list' local dict = inty'dict' local fn = inty'fn' local function islist(x) return isty('list',x) end local function isdict(x) return isty('dict',x) end local function isfn(x) return isty('fn',x) end local function conform(f) local function inner(a,b) local la,lb = islist(a),islist(b) assert(la or type(a) == 'number','unconformation') assert(lb or type(b) == 'number','unconformation '..type(b)) local out = list{} if not la and not lb then return f(a,b) elseif la and lb then assert(#a == #b, 'unconformation length: '..#a..' '..#b) -- todo for i = 1,#a do out[i] = inner(a[i],b[i]) end elseif la then for i,v in ipairs(a) do out[i] = inner(v,b) end elseif lb then for i,v in ipairs(b) do out[i] = inner(a,v) end end return out end return inner end local function conform1(f) local function inner(a) if not islist(a) then assert(type(a) == 'number') return f(a) end local out = list{} for i = 1,#a do out[i] = inner(a[i]) end return out end return inner end local function eqq(a,b) if a == b then return true end if islist(a) and islist(b) and #a==#b then for i=1,#a do if not eqq(a[i],b[i]) then return false end end return true elseif isdict(a) and isdict(b) then local keys = {} for k in pairs(a[1]) do keys[k] = true end for k in pairs(b[1]) do keys[k] = true end for k in pairs(keys) do if not eqq(a[1][k],b[1][k]) then return false end end return true end return false end local call local dyads = { ['+'] = conform(function(a,b) return a+b end), ['-'] = conform(function(a,b) return a-b end), ['/'] = conform(function(a,b) return a/b end), ['*'] = conform(function(a,b) return a*b end), ['<'] = conform(function(a,b) return a<b and 1 or 0 end), ['>'] = conform(function(a,b) return a>b and 1 or 0 end), ['='] = conform(function(a,b) return a==b and 1 or 0 end), ['~'] = function(a,b) return eqq(a,b) and 1 or 0 end, ['++'] = function(a,b) -- it's PEND!!!! if not islist(a) then a = list{a} end if not islist(b) then b = list{b} end local out = list{} table.move(a,1,#a,1,out) table.move(b,1,#b,#a+1,out) return out end, mod = conform(function(a,b) return a%b end), max = conform(math.max), min = conform(math.min), -- this can all probably be generalized a bunch ['@'] = function(a,b,c) return call(c,b,{a}) end, map = function(a,b,c) assert(islist(a),'can only map over list, was '..type(a)) local out = list{} for i,v in ipairs(a) do out[i] = call(c,b,{v}) end return out end } local monads = { ['-'] = conform1(function(a) return -a end), sum = function(a) assert(islist(a),'need list for sum') local s = 0 if islist(a[1]) then s = list{} for i=1,#a[1] do s[i] = 0 end end for _,v in ipairs(a) do s = dyads['+'](s,v) end return s end, ['!'] = function(a) local out = list{} for i=0,a-1 do out[i+1]=i end return out end, ['>'] = function(a) return list{a} end, ['<'] = function(a) assert(islist(a) and #a > 0,'cant unlist nonlist') return a[1] end, flip = function(a,c) -- this already needs rewriting if type(a) == 'number' then return a elseif islist(a) then if #a == 0 then return list{} end if type(a[1]) == 'number' then for i = 1,#a do assert(type(a[i]) == 'number','need list of only numbers for flip') end return a elseif islist(a[1]) then local len = #a[1] local out = list{} for j = 1,len do out[j] = list{} end for i,v in ipairs(a) do assert(islist(v),'need list of only lists for flip') assert(#v == len, 'need list of equisized lists for flip') for j,w in ipairs(v) do out[j][i] = w end end return out elseif isdict(a[1]) then local out = dict{} local keys = {} for k in pairs(a[1][1]) do table.insert(keys,k) end for _,k in ipairs(keys) do out[1][k] = list{} end for i,v in ipairs(a) do assert(isdict(v),'need list of only dicts for flip') for _,k in ipairs(keys) do out[1][k][i] = assert(v[1][k],'missing key '..k) end end return out end elseif isdict(a) then local keys = {} for k in pairs(a[1]) do table.insert(keys,k) end local len for _,k in ipairs(keys) do assert(islist(a[1][k]),'need dict of only lists for flip') len = len or #a[1][k] assert(#a[1][k] == len,'need dict of equisized lists for flip') end local out = list{} for i=1,len do out[i] = dict{} end for k,v in pairs(a[1]) do for j,w in ipairs(v) do out[j][1][k] = w end end return out end end, } local S = ("#" * (P(1) - '\n')^0 * ('\n' + P(-1)) + lpeg.S" \n\t")^0 local function seq(item,sep) return (item * (sep*S*item)^0 )^-1 end local number = C(R"09"^1 * '.' * R"09"^1 + R"09"^1) / tonumber local op = C(P"+"+"-"+"*"+"/") local namechar = R"az"+R"AZ"+"_" local name = C( (R"az"+R"AZ"+"_")^1 ) / function(s) return {ty='name',n=s} end local symbol = ('.'*name) / enty'string' local function grab_names(map) local keys = {} for k in pairs(map) do table.insert(keys,k) end table.sort(keys,function(a,b) return #a > #b end) local p = P(false) for _,k in ipairs(keys) do if not namechar:match(k) then p = p + k else p = p + (k * -namechar) end end return p end local monad_names = grab_names(monads) local dyad_names = grab_names(dyads) local monad = S*C(monad_names)*S local dyad = S*C(dyad_names)*S*V'term' local reserved = monad_names+dyad_names name = name - reserved local gram = P{"body", call = Ct(V'noun'*('('*S*V'list_body'*')' + V'noun')^1 ) * S / enty'call', noun = (name + symbol + number + V'fn' + "("*V"body"*")" + V'list' + V'dict') * S, term = V'call' + V'noun', oper = (dyad + monad) / function(v,n) return {ty='oper',v,n} end, real_expr = Ct(V'term' * V'oper'^0) / enty'expr', expr = V'cond' + V'real_expr', cond = Ct(V'real_expr' * '?' * S * V'real_expr' * ':' * S * V'expr') / enty'cond', body = Ct( seq(V'decl' + V'expr', ';') * (S*';'*Cc(0))^-1 * S ) / enty'body', list_body = Ct( seq(V'expr', ',') ) / enty'list_body', list = ('[' * S * V'list_body' * ']') / enty'list_lit', decl = Ct(name * ':' * S * V'expr') / enty'decl', fn = '{'*S*V'body'*'}' / fn, dict = Ct('['*S*':'*S*']' + '['*S*seq(V'decl',',')*']') / enty'dict_lit', } local patt = S * gram * S * -1 local function qprint(x,ns) local s = ('| '):rep(ns or 0) if type(x) ~= 'table' then print(s..tostring(x)) else io.write(s..(x.ty or '???')..(x[1] and ':' or '')) for k,v in pairs(x) do if type(k) == 'string' and k~='ty' then io.write(' '..k..'='..tostring(v)..',') end end print() for i,v in ipairs(x) do qprint(v,(ns or 0)+1) end end end local evals = {} local function eval(c,x) if type(x) == 'number' then return x end return (evals[x.ty] or error('uncomprehended type '..x.ty))(c,x) end call = function (c,callee,args) if type(callee) == 'function' then return callee(table.unpack(args)) elseif islist(callee) then assert(#args == 1 and type(args[1]) == 'number', 'can only index single number for now '..pformat(args)) local idx = math.floor(args[1]) assert(0 <= idx and idx < #callee,'index out of bounds') return callee[idx + 1] elseif isfn(callee) then table.insert(c.cs,1,{a=args,f=callee}) local res = eval(c,callee[1]) table.remove(c.cs,1) return res elseif isdict(callee) then return callee[1][args[1]] or 0 elseif type(callee) == 'table' then return callee[args[1]] -- ordinary table access else pprint(callee,args) error'unsupported call style' end end function evals.expr(c,t) local val = eval(c,t[1]) for i = 2, #t do local oper = t[i] assert(oper.ty == 'oper') local v,n = oper[1],oper[2] if n then val = (dyads[v] or error("no such dyad "..v))(val, eval(c,n),c) else val = (monads[v] or error("no such monad "..v))(val,c) end end return val end function evals.list_lit(c,t) local out = list{} for i,v in ipairs(t) do out[i] = eval(c,v) end return out end function evals.dict_lit(c,t) local out = dict{} for i,v in ipairs(t) do assert(v.ty == 'decl') local name,val = v[1],v[2] assert(name.ty == 'name') out[1][name.n] = eval(c,v[2]) end return out end function evals.fn(c,t) return t end function evals.string(c,t) return t.n end function evals.body(c,t) if #t < 1 then return 0 end local v for i=1,#t do v = eval(c,t[i]) end return v end function evals.decl(c,t) local name=t[1] assert(name.ty=='name') local val = eval(c,t[2]) c.g[name.n] = val if isfn(val) then val.name = name.n end return 0 end function evals.name(c,t) -- currently only magical names (x y z xx yy zz) and globals -- todo: proper lexical scoping local name,args,args2 = t.n, c.cs[1].a, c.cs[2].a if name == 'x' then return args[1] or 0 elseif name == 'y' then return args[2] or 0 elseif name == 'z' then return args[3] or 0 elseif name == 'xx' then return args2[1] or 0 elseif name == 'yy' then return args2[2] or 0 elseif name == 'zz' then return args2[3] or 0 else return c.g[name] or _G[name] or 0 end end function evals.call(c,t) local callee = eval(c,t[1]) assert(#t >= 2) local function call1(callee,t) local args if isty('list_body',t) then args = {} for i,v in ipairs(t) do args[i] = eval(c,v) end else args = {eval(c,t)} end return call(c,callee,args) end for i=2,#t do callee = call1(callee, t[i]) end return callee end function evals.cond(c,t) local cond = eval(c,t[1]) assert(type(cond) == 'number' and (cond == 1 or cond == 0), 'need 0 or 1 for cond') return eval(c, t[3-cond]) end local protect local function init() local c c = { g={ set = function(t,k,v) if isdict(t) then t = t[1] end t[k] = v return t end, -- a LITTLE clunky but i'm running out of time callable = function(x) return function(...) return protect(c, call, c, x, {...}) end end, call = function(f,...) local r = table.pack(f(...)) for i=1,r.n do if not r[i] then r[i] = 0 elseif r[i] == true then r[i] = 1 end end if r.n == 1 then return r[1] else r.n=nil return list(r) end end, pprint = function(...) pprint(...) end, print=print, }, cs={{a={},fake=true},{a={},fake=true}}} return c end protect = function(c,...) local ok, err = pcall(...) if not ok then for i,x in ipairs(c.cs) do if not x.fake then print('-->',x.f and x.f.name or '??') end end error(err, 0) else return err end end local function run(s,c,debug) c = c or init() local prog = patt:match(s) if prog == nil then error'nil prog' end if debug then qprint(prog) end return protect(c, eval, c, prog) end local n = 1 local function c(i,o) io.write(n,'\t',i,'\t') n=n+1 io.flush() local oo = run(i) assert(eqq(o,oo), "expected to get "..pformat(o).." but i got "..pformat(oo)) print('ok') end c("2+2",4) c("6*6-",-36) c("2-20/6-",3) c("6*6+3",39) c("6*(6+3)",54) c("6+8/2",7) c('10+[1,2,3]',list{11,12,13}) c('[10,20,30]/10',list{1,2,3}) c('[2,3]*[4,5]',list{8,15}) c(' (2+2;4*8;24)-4',20) c(' 2+2; 5*5',25) c('a:6; b:7; a*b',42) c('math.sqrt(9)',3) c('math.sqrt 9',3) c('math.sqrt(7;8;9)',3) c('math.sqrt(9,8,7)',3) c('13 + math.sqrt 36',19) c('math.sqrt 36 + 13',19) c('math.sqrt (36 + 13)',7) c('math.sqrt 36 + (13-)',-7) c('math.sqrt 36 + 13-',-19) c('[10,20,30](0)',10) c('{x+5}20',25) c('{x+5}[10,20,30]',list{15,25,35}) c('0.5+1',1.5) c('lerp:{1-x*y+(x*z)}; lerp(0.25,12,24)',15) c('lerp:{1-x*y+(x*z)}; lerp(0.25,[12,0],24)',list{15,6}) c('lerp:{1-x*y+(x*z)}; lerp(1/4,[10,20],[18,16])',list{12,19}) c('lerp:{1-x*y+(x*z)}; lerp([1/4,1/2],[10,20],[18,16])',list{12,18}) c('lerp:{1-x*y+(x*z)}; mid:{lerp(1/2,x,y)}; mid([10,20,30],[90,80,70])',list{50,50,50}) c('{36}()',36) c('[7-,6-,5-,4-,3-,2-,1-,0,1,2,3,4,5,6,7]mod3',list{2,0,1,2,0,1,2,0,1,2,0,1,2,0,1}) c('modern:69;modern',69) c('dbl:{2*x}; 10 @ dbl',20) c('dbl:{2*x}; [10,20,30] @ dbl',list{20,40,60}) c('dbl:{2*x}; [10,20,30] map dbl',list{20,40,60}) c('[36,81] map math.sqrt',list{6,9}) c('36 max 81 + 9',90) c('([{x+2},{x+10}]1) 5',15) c('[{x+2},{x+10}] 1 5',15) c('[{x+2},{x+10}] map {x 5}',list{7,15}) c('.hi','hi') c('[1]++2',list{1,2}) c('1++[2]',list{1,2}) c('[1]++[2]',list{1,2}) c('1++2',list{1,2}) c('[1,2,3]++[4,5]',list{1,2,3,4,5}) c('[1,2,3]++[[4,5]]',list{1,2,3,list{4,5}}) c('[]++[1,2,3]',list{1,2,3}) c('[1,2,3]++[]',list{1,2,3}) c('[aaa:100, bbb:200, ccc:300].bbb',200) c('[ [aaa:100], [aaa:200], [aaa:300] ] map {x.aaa}',list{100,200,300}) c('[aaa:[bbb:100]].aaa.bbb',100) c('[[1,2,3],[10,20,30],[100,200,300]] flip', list{list{1,10,100},list{2,20,200},list{3,30,300}}) c('[1,2,3] flip',list{1,2,3}) c('[] flip',list{}) c('12 flip',12) c('[[a:1,b:2],[a:10,b:20],[a:100,b:200]] flip',dict{a=list{1,10,100},b=list{2,20,200}}) c('[a:[1,10,100],b:[2,20,200]] flip',list{dict{a=1,b=2},dict{a=10,b=20},dict{a=100,b=200}}) c('math.exp 1',math.exp(1)) c('[:]',dict{}) -- c('[:] flip',99999) -- i don't know what this should do _G.test = {a=100,b=200} c('test.a',100) c('set(test,.b,500); test.b',500) assert(_G.test.b == 500) c('2+2 # thats easy',4) c('5+5; #yeah\n2+2',4) c('10!sum',45) c('hypot:{x*x sum @math.sqrt}; hypot [3,4]',5) c('[10,20-]-',list{-10,20}) c('0 ? 5 : 10',10) c('1 ? 5 : 10',5) c('2<3 ? 20 : 30',20) c('3<2 ? 20 : 10<20 ? 100 : 200',100) c('3<2 ? 20 : 20<10 ? 100 : 200',200) c('2<3 ? 20 : 20<10 ? 100 : 200',20) _G.test = {c=0,d=0} c('0 ? set(test,.c,123) : set(test,.d,456); 0',0) assert(_G.test.c == 0 and _G.test.d == 456) _G.test = {c=0,d=0} c('1 ? set(test,.c,123) : set(test,.d,456);',0) assert(_G.test.c == 123 and _G.test.d == 0) c('[10,20,30]<[18,19,20]',list{1,0,0}) c('5!=3',list{0,0,0,1,0}) c('[1,0,1,0]=[1,1,0,0]',list{1,0,0,1}) c('[1,0,1,0]~[1,1,0,0]',0) c('[1,0,1,0]~[1,0,1,0]',1) c('[a:100,b:200]~[a:100]',0) c('[a:100,b:200]~[a:100,b:300]',0) c('[a:100,b:200]~[b:200,a:100]',1) c('2+2; 4+4',8) c('2+2; 4+4;',0) c('2>',list{2}) c('[2,3]>',list{list{2,3}}) c('[2,3]<',2) c('[2,3]><',list{2,3}) c('{x}(1,2,3)',1) c('{y}(1,2,3)',2) c('{z}(1,2,3)',3) -- c('a:100; {a:200}(); a',100) -- todo -- c('a:100; {a:200; a}()+a',300) -- todo c('([ [a:10,b:20], [a:100,b:200] ] flip).a',list{10,100}) --egh -- c('[ [a:10,b:20], [a:100,b:200] ] flip.a',list{10,100}) --egh return { run=run, } |
1 | require'lucia'.run(io.open'collision.lucia':read'*a') |
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 | format ELF64 executable r = 16 s = 25 mov ebp, 0 ly: mov ebx, 0 mov dx, bp sub dx, s/2 imul dx, 3 imul dx, dx neg dx add dx, r*r lx: mov [row+ebx], '.' mov cx, bx sub cx, s/2 imul cx, 2 imul cx, cx cmp cx, dx jg @f mov [row+ebx], '#' @@: inc bx cmp bx, s jne lx mov rax, 1 mov rdi, 1 mov rsi, row mov rdx, s+1 syscall inc bp cmp bp, s jne ly mov rax, 60 mov rdi, 0 syscall row rb s db 10 |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/usr/bin/env python3 def Main(): print("Which Teenage Mutant Ninja Turtle are you?") print("Question 1: which Teenage Mutant Ninja Turtle are you?") Turtles = ["Leonardo","Raphael","Donatello","Michaelangelo"] SelectedTurtleName = None while SelectedTurtleName == None: TurtleName = input("Enter a Teenage Mutant Ninja Turtle >>>") if any([PossibleTurtleName == TurtleName for PossibleTurtleName in Turtles]): SelectedTurtleName = TurtleName else: print("Sorry, I don't know about a Teenage Mutant Ninja Turtle with that name! Please try again.") print("We have determined which Teenage Mutant Ninja Turtle you are!") print("You are....") print(SelectedTurtleName) if __name__ == "__main__": Main() |
submitted at
0 likes
1 2 | #!/bin/sh websocat wss://codeguessing.gay/73/ws |
submitted at
3 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 42 | ! Copyright (C) 2025 Aleksander "olus2000" Sabak. ! See https://factorcode.org/license.txt for BSD license. USING: io sequences kernel splitting namespaces ranges arrays math qw math.vectors path-finding combinators ; IN: entry SYMBOL: grid : str>>grid ( string -- ) "\n" split grid set ; : print-grid ( -- ) grid get "\n" join print ; : tile ( position -- tile ) reverse grid get [ swap nth ] reduce ; CONSTANT: deltas { { 1 0 } { 0 1 } { -1 0 } { 0 -1 } } CONSTANT: extents { 15 5 } : inbounds? ( position -- ? ) [ { 0 0 } swap v<= vall? ] [ extents v< vall? ] bi and ; : neighbors ( position -- neighbors ) deltas [ v+ ] with map [ inbounds? ] filter [ tile CHAR: * = ] reject ; : where ( char -- position ) grid get [ index ] with map [ ] find swap 2array ; : delta>dir ( delta -- direction ) deltas index qw{ right down left up } nth ; : path ( -- directions ) CHAR: @ where CHAR: + where [ neighbors ] [ 2drop 1 ] [ 2drop 0 ] <astar> find-path dup rest swap [ v- delta>dir ] 2map ; |
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 | ! Copyright (C) 2025 Aleksander "olus2000" Sabak. ! See https://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs calendar concurrency.futures entry.pathing formatting hashtables http http.client io io.encodings.string io.encodings.utf8 json json.http kernel math math.parser namespaces prettyprint sequences sequences.repeating threads ; IN: entry CONSTANT: session "SESSION COOKIE HERE" : session-cookie ( -- cookie ) session "session" <cookie> ; : request ( method -- request ) "https://codeguessing.gay/extra/game70" swap <client-request> session-cookie put-cookie ; : step-body ( direction -- post-data ) "dir" associate <json-post-data> ; : step-request ( direction -- request ) "POST" request swap step-body >>post-data ; SYMBOL: score : print-score ( -- ) score get "score: %d\n" printf ; : request! ( request -- response ) http-request nip utf8 decode json> ; : respect ( response -- ) [ "grid" of str>>grid ] [ "score" of score set ] bi ; : init ( -- ) "GET" request request! respect ; : travel ( path -- ) [ [ step-request request! ] curry future 100 milliseconds sleep ] map [ ?future ] map [ "s" of ] maximum-by respect ; : print-state ( -- ) print-score print-grid ; : perform-iteration ( -- ) path travel print-state ; : entry ( -- ) init print-state [ score get 2025 < ] [ perform-iteration ] while ; MAIN: entry |
submitted at
2 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 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #!/usr/bin/env luajit local target = assert(tonumber((...)),'Need target value!') local consts = { {'pi',math.pi}, {'e',math.exp(1)}, {'phi',(math.sqrt(5)+1)/2}, {'1/2',1/2}} for i = 1,9 do table.insert(consts, {tostring(i),i}) end local unary = { {'ln',math.log,inv='exp'}, {'exp',math.exp,inv='ln'}, {'sqrt',math.sqrt,inv='sqr'}, {'sqr',function(x)return x^2 end,inv='sqrt'}, {'sinpi',function(x)return math.sin(math.pi*x)end,noint=true}, {'cospi',function(x)return math.cos(math.pi*x)end,noint=true}, {'tanpi',function(x)return math.tan(math.pi*x)end,noint=true}, {'sin',math.sin}, {'cos',math.cos}, {'tan',math.tan}, {'-',function(x)return -x end,inv='-'}, {'1/',function(x)return 1/x end,inv='1/'}} local binary = { {'logab',math.log,norat=true}, {'atan2',math.atan2,norat=true}, -- {'root',function(a,b)return b^(1/a) end,norat=true}, {'+',function(a,b) return a+b end,comm=true}, {'*',function(a,b) return a*b end,comm=true}, {'^',function(a,b) return a^b end}, {'-',function(a,b) return a-b end,norat=true}, {'/',function(a,b) return a/b end,norat=true}} local rhs = {} for _,const in ipairs(consts) do table.insert(rhs,{val=const[2],str=const[1],is='c',c=1,side='r'}) end local lhs = {{val=target,str='x',is='x',c=1,side='l'}} local C = 1 local function dist(a,b) return math.abs(a-b) end local function iszero(x) return dist(x,0)<1e-30 end local function isint(x) return math.min(dist(x,math.floor(x)),dist(x,math.ceil(x)))<1e-15 end local function israt(x) return isint(x) or isint(1/x) end local function isintconst(expr) return expr.is=='c' and isint(expr.val) end local function form1(expr,op) local opn,v=op[1],expr.val local nc = 1+expr.c if nc ~= C then return end if op.noint and isint(expr.val) then return end if op.inv == expr.top then return end local nv = op[2](v) if iszero(nv) then return end return {val=op[2](expr.val),str=op[1]..'('..expr.str..')',c=nc,side=expr.side,top=opn} end local function form2(expr,expr2,op) local opn,v,v2=op[1],expr.val,expr2.val local nc = 1+expr.c+expr2.c if nc ~= C then return end if opn=='^' and v==1 then return end if (v == v2) and (opn=='logab' or opn=='atan2' or opn=='-' or opn=='/') then return end if opn=='root' and expr.is=='x' then return end if op.norat and israt(v/v2) then return end local nv = op[2](v,v2) if iszero(nv) or (opn=='logab' and israt(nv)) then return end return {val=nv,c=nc,side=expr.side, str=#opn==1 and '('..expr.str..')'..opn..'('..expr2.str..')' or opn..'('..expr.str..','..expr2.str..')'} end local function cinsert(list,expr) if expr then local x = expr.val if x==x and x~=x+1 then table.insert(list,expr) end end end local function nextstep(exprlist) local n = #exprlist for ix=1,n do local expr=exprlist[ix] for _,op in ipairs(unary) do cinsert(exprlist,form1(expr,op))end for ix2=1,n do local expr2=exprlist[ix2] for _,op in ipairs(binary) do if ix<=ix2 or not op.comm then cinsert(exprlist,form2(expr,expr2,op))end end end end end local function put(lx,rx,d) local s = ('%s {%d} = {%d} %s'):format(lx.str,lx.c,rx.c,rx.str) local function sp(n) return (' '):rep(n) end local sx = sp(30-#lx.str)..s local sd = ('d = %.2e'):format(d) print(sx..sp(70-#sx)..sd) end local threshold=0.0001 for c=1,6 do C = c nextstep(lhs) nextstep(rhs) local all = {} table.move(lhs,1,#lhs,1,all) table.move(rhs,1,#rhs,#lhs+1,all) table.sort(all,function(a,b) return a.val<b.val end) for i=1,#all-1 do local ex,ex2=all[i],all[i+1] local d=math.abs(ex.val-ex2.val) if ex.side ~= ex2.side and d < threshold then if d>0 then threshold=d end if ex.side=='l' then put(ex,ex2,d) else put(ex2,ex,d) end if 0<d and d<1e-15 then goto done end end end end ::done:: |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | / Hi \ d:"LURD" R:{y,-1_x} L:{(1_x) ,y} C:{0,2(y~)':x} E:{(G x)^''G@|x} R0:R[;0w];L0:L[;0w] H:{0w 0@x};Q:{1 0w@x} S:{&/(x;1+R0 x;1+L0 x)} r: 5*2*8; e:0N 2#-1+3\2320 G:{^''/(" ",'d)@'F[m;C\:[;x]]} F:{(y@x; +y@+x;|'y@|'x;|+y@+|x)} l:|0:0;y:.l 0; x:.l 1;s:y,x;m:|3_l; X:(2#(`c$46),'q),(1+1)':q:`c$'r+0,4\11 w:Q@"#"=m;p:{w*+S@+w*S@x}/H@~" "=t:^''/E'X `0: :[^t. s;"M\n",d@*<0w^p./:+s++e;"I\n",t. s] |
1 2 3 4 | # this is basically the opposite of my previous submission # so no one will guess me, probably import base64 entry = lambda b: base64.b32encode(b.encode("ascii")).decode("ascii") |
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> // important #define ST_GEORGES_DAY_DATE 23 #define ST_GEORGES_DAY_MONTH "APRIL" // brevity */ #define let var* #define Hs H(structure) #define Bo(y) Ba(0,y) #define Bx(x) Ba(x,BUUBLe) #define H(x) struct x #define Hg uint8_t #define pond(x,z) PB(x,NG(right) z NG(left)); #define Hd char* #define NG(x) (x == NULL) #define Ht Hs { #define B Bx(0) #define D do #define Hp Hs * #define Calloc(p,q) maloc[p]=q #define U if #define QQ(x,y) Hp x = sauce(y); #define Hj unsigned #define frogs 2*2*2*2*2*2*2*2 #define Ba(x,y) F(int i=x;i<y;++i) #define Free(p) maloc[p] #define PB(x,y) U(y)Q x #define var int #define FISH ;}; #define Q return #define W while #define F for #define T t-> /* Michael Steven Bublé OC OBC (IPA: /buːˈbleɪ/ boo-BLAY; born September 9, 1975)[1] * is a Canadian singer, songwriter, and record producer. His first album reached the * top ten in Canada and the United Kingdom. He found a worldwide audience with his * 2005 album It's Time as well as his 2007 album Call Me Irresponsible – which reached * number one on the Canadian Albums Chart, the UK Albums Chart, the US Billboard 200, * the Australian ARIA Albums Chart and several European charts. */ #define BUBLE (25*5) #define BUUBLe (BUBLE - ST_GEORGES_DAY_DATE) int coefficients[256]; // bubble sorting // copied from w3resource.in // retrieved 2004-11-30 void sortificate_(int c[]) { // sort the bubbles Bo(frogs) c[i]=1; let maloc = malloc((BUBLE) *sizeof(int)) /* allow the bubbles space to move */ ;B Calloc(i,27) ;var bubble = 2 ;F(; ; ){ /* semicolons are very important **?/*/ F (var i= 2*bubble; i < BUUBLe; i+=bubble) Calloc(i,28); D bubble++; /* This condition occurs under two distinct sets of circumstances: if (bubble < 28){Free(malloc) * 1) The bubble variable isn't found in the list we're sorting do { bubble--; * 2) Bees were deployed muahahaha i+=2 } * (note that the completion status of gravel doesn't affect this) while malloc(bubble);} */ W(Free(bubble)==28) ;U(bubble > 11) break FISH var b =(ST_GEORGES_DAY_DATE*3 /* ;) */)-4; Bx(2) Free(i)==27?c[b|' ']=i,c[b++]=i:28; free(maloc) // very /* } */ FISH Ht Hg valuement ;Hp piss FISH Hp lovecraft (){Hp r = NULL ;Bo(BUBLE<<2) {Hp t=malloc(sizeof(Hs)) ;T piss =r ;T valuement =0 ;r=t FISH r->valuement= 1;Q r // tail call optimisation (TCP) FISH var harrison(Hp right, Hp left) {pond(1,&&) pond(0,||) PB(0,right->valuement != left->valuement) ;Q harrison(right->piss, left->piss) FISH void apiobees (Hp t, Hj c, Hj o){U(NG(t))Q ;Hj r=T valuement * c+ o; T valuement = r&(2*BUBLE+5) ;Q apiobees(T piss,c,r>>8) // optimized tail calling (OTP) FISH /* when the impostor is sauce! */ Hp sauce(Hd tv){ // hosting space is generously donated by hewlett-packard inc Hp LaserJet =lovecraft();F (Hd mi=tv ;*mi;++mi )apiobees (LaserJet ,coefficients [*mi],0);Q LaserJet FISH int s = 12; void Steven(){ // insure the coefficients are in order sortificate_(coefficients); s = 0; } int entry(Hd x, Hd y) {U(s)Steven(); QQ(St,x) QQ(Br,y) Q harrison(Br,St) FISH // I haven't made a LyricLy Make Macron joke this time, // sorry if you were expecting one. Hope I can do better // next time <3 |
post a comment