Commit graph

54 commits

Author SHA1 Message Date
sterni
2b308c64b9 feat(sterni/aoc/2022): day16 part 1 k solution
Change-Id: I4d141e0d911157ae17f12066b859297836d4858b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7897
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2023-01-22 14:36:01 +00:00
sterni
5c748780b5 fix(sterni/aoc/2022): make solutions executable in bqn drv
BQNLIBS dependency also needs to be provided in the derivation running
all solutions.

Change-Id: I704369127ab92a52c7e4b21de8b7982fb8328f9d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7662
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-28 12:20:41 +00:00
sterni
6aafe2a223 chore(sterni/aoc/2022): nuke Nix solutions
Didn't end up happening due to a lack of motivation. Will try to finish
the BQN AoC still, though.

Change-Id: Ib296aec9f3cfeef57c79a9ba09fc664c1a19dcff
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7661
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-28 12:20:41 +00:00
sterni
a25c60361e feat(sterni/aoc/2022): day25 array solutions
Another approach for figuring out the SNAFU digits in k:
https://github.com/leahneukirchen/adventofcode2022/blob/master/day25.k

Change-Id: Iddf424aff8fcac176109fd35ef44bdd875302adc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7647
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-27 13:35:08 +00:00
sterni
835ea6ca7d feat(sterni/aoc/2022): day21.1 BQN solution
This one is not finished yet, but needs to move of this laptop by ways
of git.

Change-Id: I2c8c0a7b581a654f7cfab92dd21ced82a14c5f42
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7616
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-23 14:34:55 +00:00
sterni
c3c29827ed feat(sterni/aoc/2022): day17 BQN solution
Change-Id: I1e2dd583c5f782afb679beeb43ceffa0cbc5c59e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7607
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-20 23:02:24 +00:00
sterni
c3be4f6f59 feat(sterni/aoc/2022): day15 BQN solution
Part 2 is pretty slow, since we just reuse our fast solution for part 1.
This means we have to check 4000000 which could be reduced a bit by
using a loop. It is tolerably slow, so whatever. (Overall this problem
would have been more fun if the space to check was smaller.)

Change-Id: I1203330fe0364894cfe0318376e583868937b5bd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7603
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-20 19:08:30 +00:00
sterni
68555896de feat(sterni/aoc/2022): day20 BQN solution
This solution feels very un-BQN-esque, but I could not get it to work by
doing arithmetic operations on an array of indices for any input but the
example one. It's still decently fact considering that we create so many
intermediate arrays at each step.

Change-Id: I883409b4d99d4954312df9b9a9ffc568c39f7726
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7602
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-20 19:03:28 +00:00
sterni
ba719f8f5e feat(sterni/aoc/2022): day18 BQN solution
Change-Id: I1504cd5e443ff0b28c2d97ae357e5d92c88bba4d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7601
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-20 19:01:26 +00:00
sterni
c9a44bfe15 feat(sterni/aoc/2022): day12 BQN solution
Change-Id: Ib80fe824341964f46a45599c18fa00635ba02aaf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7600
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-20 19:01:26 +00:00
sterni
8fda0544d7 feat(sterni/aoc/2022): day13 BQN solution
Change-Id: I401ba09198d447628fa76d811fd4fe780baa8240
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7586
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-13 14:52:19 +00:00
sterni
4f1b55c27b refactor(sterni/aoc/2022/10): tidy up image rendering
Change-Id: I374373e86e78277cf2caf8509c477a508a2ceba1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7584
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-12 23:48:17 +00:00
sterni
867210f084 feat(sterni/aoc/2022): day11 BQN solution
Change-Id: If9c510e3530ecc1acafa1d708eacf64eb1132db7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7583
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-12 23:48:17 +00:00
sterni
b8afed6dd4 refactor(sterni/aoc/2022/05): rank 2 array into list of lists w/ <˘
Change-Id: Ic536908bad5bb4af860ec53bd585ed74af3117af
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7557
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-10 20:51:35 +00:00
sterni
c381fa64cf feat(sterni/aoc/2022): day10 BQN solution
I cheated a bit to skip implementing multi cycle instructions. The VM is
pretty much a normal tail recursive function, but working with scalars
in BQN is on brand-ish. Array programming helps again when drawing the
picture on screen.

Change-Id: I2562c862e228f633c5fad09e503529c6e0785112
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7556
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-10 20:29:31 +00:00
sterni
42a4f14878 feat(sterni/aoc/2022): day09 BQN solution
Change-Id: Idad006eaacbd89827feb5bbd9d6e04605743fca2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7555
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-10 18:36:09 +00:00
sterni
1649799cb7 feat(sterni/aoc/2022): day08 BQN solution
Added utility used to be related, but got dropped in a refactor.

Change-Id: I1f88973d6b42f1302b49cd61c53e4cd1e15b8c6f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7553
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-10 15:22:33 +00:00
sterni
11abe4784c feat(sterni/aoc/2022): day07 BQN solution
Did not have the motivation to go back and improve things, so this is my
initial attempt.

Change-Id: I3e129523d8f6c03bfbe50351f78d56ec7254a2dc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7539
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-07 19:17:34 +00:00
sterni
17e0a74e7b refactor(sterni/aoc/2022/05): improve parsing a bit
By taking advantage of filling (ironically) we can avoid creating a spec
in an ugly way. Additionally we transpose before parsing which doesn't
really make all that much of a difference, though.

Change-Id: Ida593138654f8367d666447f2b62013e8ddff01e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7535
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-06 14:45:48 +00:00
sterni
efbac0813c feat(sterni/aoc/2022): day06 array solutions
Today's problem works very nicely thanks to window although the indexing
sadly is off by a constant amount from what we immediately get. I have a
feeling someone is going to demolish my 31 char k solution.

Change-Id: Ia90786ce2fe321235286a85c466decf7feb669ed
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7534
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-06 14:45:48 +00:00
sterni
3f2172556a refactor(sterni/aoc/2022/05): improve _ApplyCmd
* take advantage of block header for destructuring

* instead of ModestTake we can split the stack we are picking from into
  what we need to move and what to keep, saving us from having to repeat
  ourselves.

* remove some unnecessary parens

Change-Id: I1b81a93a27d14dcbb6bdd109e862a356f611aca9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7530
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-05 21:45:16 +00:00
sterni
736edce338 feat(sterni/aoc/2022): day05 BQN solution
First input that is genuinely fun to parse in BQN. There surely is a
nice trick for _ApplyCmd, but this works and I'm unable to think today.

Change-Id: Iefccc81f1c1db03f45e31aaf7a1703ac0f91306f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7529
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-05 18:58:30 +00:00
sterni
5a41c4c6aa feat(sterni/aoc/2022): day04 BQN solution
Very tired today, but seems like a decently tidy solution.

Change-Id: Id3055159ae99e9b91fcc4b9b41ec7fe5e9a1bc6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7528
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-05 18:58:30 +00:00
sterni
674195f92b fix(sterni/aoc/2022/01): fix output format
Change-Id: I7e2e82faa70ded683765627ba35e6f237976363f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7526
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-05 01:01:00 +00:00
sterni
6a3826e4b7 feat(sterni/aoc/2022): day03 k solution
Change-Id: If31e7047fc0c286e3e40b23a13fb9c51297809af
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7525
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-05 01:01:00 +00:00
sterni
0251f56575 feat(sterni/aoc/2022): day03 solution
Change-Id: I0f23d4d6405779fe7e804eb8b9f407dc4de88760
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7502
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-03 15:50:31 +00:00
sterni
9fed61297a feat(sterni/aoc/2022): day02 k solution
Uses the same idea as the BQN solution, but is very concise.

Change-Id: I876208e5e86f28240f4a3384d16321fd92d077eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7499
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-03 01:25:32 +00:00
sterni
c0e70de17a feat(sterni/aoc/2022): day02 solution
It seems to me that there must be some way to improve this further,
but I'm kind of out of time.

Change-Id: Icf3510b6c126345551125543aec70155b6eeff4e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7498
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-02 18:31:30 +00:00
sterni
7ffeb4f7f1 refactor(sterni/aoc/2022): use scan in BQN/k
We can actually use one and the same scan on the sorted list
to solve part 1 and 2 of the assignment.

Change-Id: I657a81bad6151ef4fe13239db88d2dbd2f9c29d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7491
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-02 02:21:01 +00:00
sterni
7e122fdcbc feat(sterni/aoc/2022): day01 solutions
Bonus solution in k as I got sniped by leah2.

Change-Id: I806f5b2ac1388159a427bb239bfb1bb7aeb329d7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7490
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-01 23:50:32 +00:00
sterni
7b87b2ccbb feat(sterni/exercises/aoc/2022): add basic scaffolding
I currently plan doing BQN and Nix (where it is not too annoying,
respectively). All solutions can either be executed together in a
derivation using CBQN and Tvix (!!!) or executed individually (I'll do
one file per solution for BQN and an attribute set of solutions for Nix
in a single file).

Change-Id: I7cff2ea60d06ae0f586d07779f14f5edd8f87aae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7489
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-01 23:50:32 +00:00
sterni
6abea467e2 chore(sterni/exercises/aoc): split out utils into a library of sorts
Change-Id: Id2bb764fcdcd4b345eed6a98e0d67fcb18fc1353
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7488
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-01 23:38:46 +00:00
Vincent Ambo
aa122cbae7 style: format entire depot with nixpkgs-fmt
This CL can be used to compare the style of nixpkgs-fmt against other
formatters (nixpkgs, alejandra).

Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: eta <tvl@eta.st>
Reviewed-by: grfn <grfn@gws.fyi>
2022-01-31 16:11:53 +00:00
sterni
666a944c59 feat(sterni/aoc/2021): day 10 solution
Change-Id: I5feb7187bd9aee45478aa5759e94df49e92565bf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4734
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-28 16:42:41 +00:00
sterni
dea67c9d78 feat(sterni/aoc/2021): day 11 solution
Change-Id: I59087cd855953d0ebdcaaea2374788e9e015e1ea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4733
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-28 16:42:41 +00:00
sterni
d052bc5953 feat(sterni/aoc/2021): day 4 solution
Change-Id: Ib8b4206b40acad32e10ebd9103e54074ba3452fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4681
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-26 19:51:25 +00:00
sterni
675f97e535 feat(sterni/aoc/2021): don't split on consecutive occurrences of 𝕨
Change-Id: I2ab17e0238df297f580c45bc28914c6dfd0ce848
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4680
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-26 19:51:24 +00:00
sterni
798b439c4b feat(sterni/aoc/25): day 25 part 1 solution
Change-Id: I8ffefd2b85e595bdae2cfb2bf7b34ea63b82c457
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4627
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-25 23:21:04 +00:00
sterni
d44b57b641 feat(sterni/aoc/2021): day 20 solution
Change-Id: Id864d6e6f0722c2da5d3487bd38da80e6bff2161
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4566
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-25 11:18:11 +00:00
sterni
4fbb2a1658 feat(sterni/aoc/2021): day 6 solution
Change-Id: Icd21b0f0c92b596fbb369d6f08715a6554259572
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4558
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-25 10:46:51 +00:00
sterni
01f4212ca1 feat(sterni/aoc/2021): day 15 solution
Change-Id: Idca2ae2829a7ee9e856aa7fcdc716c3055051062
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4363
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-16 12:43:46 +00:00
sterni
0357dd973b chore(sterni/aoc/2021): add shell for running solutions.bqn
Change-Id: I2e192dec9eb863a1b2386d40d26eeeeb57e1ed28
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4350
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-16 09:19:01 +00:00
sterni
b5678cbd5f feat(sterni/aoc/2021): day 14 solution
Change-Id: I8b6c0c5d1ced89eadaeea3fb619d37e77a439965
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4349
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-15 23:58:17 +00:00
sterni
3f8c99f5c3 refactor(sterni/aoc/2021): fold over 2d array instead of nested list
Seems to save some allocations and thus recover some performance
compared to the two separate folds we had before.

Change-Id: Ie3d283103e6a9b8aa702db633d9c988fda1b2903
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4348
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-15 23:58:17 +00:00
sterni
c7ebb34f8f refactor(sterni/aoc/2021): use a fold instead of last scan element
We can use the reverse swap trick to get a forward fold.

Change-Id: I88185e2ff0b41ec1454f414db2d24b1c8173ac2d
2021-12-14 13:41:01 +00:00
sterni
b5eb90196e refactor(sterni/aoc/2021): determine width/height in the same fold
Change-Id: I39410171402cedc3ee8d9ac972557656ed12de53
2021-12-14 00:56:31 +01:00
sterni
1303f3fc71 feat(sterni/aoc/2021): day 13 solution
Change-Id: I9cfa8a28854cbee7e8e1b457faf9c572353e803f
2021-12-13 23:39:50 +00:00
sterni
7a1a8aa3aa refactor(sterni/aoc/2021): name input data more consistently
Change-Id: Ibcea43d2e51f14d8b1b021050310f88d44d970d3
2021-12-13 23:39:49 +00:00
sterni
464bbcb15c feat(sterni/aoc/2021): day 9 solution
Change-Id: I90e7a47d5418abeff1ae7cc5757b6a8b3b0d1086
2021-12-13 22:13:29 +01:00
sterni
343b811bbc feat(sterni/aoc/2021): day 7 solution
Change-Id: I8c8b535defb42f15eafc816ebe953e51b11ea702
2021-12-13 21:58:15 +01:00