1
0
Fork 0
Commit graph

72 commits

Author SHA1 Message Date
06243918fc
vectors: return value instead of reference
There was no use-case for returning reference rather than a value and
in majority of case the dereference was needed.

When using 2D/3D vectors, they are mostly initialized with the numbers
and it is contraproductive to pass around references to numbers as they
are more expensive than the copies.

Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 20:09:35 +01:00
f151a9a785
day(25): sprinkle in some traits
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 20:09:34 +01:00
38a2440438
day(25): add initial solution
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 16:42:18 +01:00
89a9758e64
day(18): add solution
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 16:19:37 +01:00
ca5174b41e
vectors: factor out and implement 3D vector
• factor out the vectors to separate module
• implement ‹Vector3D›

Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 16:18:42 +01:00
0cd41d53df
day(23): add solution
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 12:32:06 +01:00
4fe0d4d891
day(20): add solution
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-07 12:30:28 +01:00
08246225fb
refactor: publicly use common types/macros in solution
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-06 20:00:52 +01:00
c087e388ac
day(15): add solution
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-03 22:16:21 +01:00
f7840f5eae
day(02): reformat
have no clue what changed…

Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-03 22:14:49 +01:00
99398e0dae
day(12): fix clippy remark
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-03 22:14:19 +01:00
9aa15bbf6f
vector2d: Implement ‹Index› and ‹IndexMut› traits
Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-01-03 22:10:26 +01:00
cdd4087cd6 vector2d: refactor ‹in_range› 2022-12-30 12:11:56 +01:00
b02e7207ac vector2d: refactor indexing 2022-12-30 12:11:41 +01:00
37a4fca618
day(14): refactor based on Google Chat suggestions
• get rid of the ‹lines›
• simplify free falling check

Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-14 17:13:11 +01:00
2ac9103fe2
day(14): refactor
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-14 15:47:56 +01:00
6789a40038
day(14): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-14 15:36:29 +01:00
bf8c4ddc67
vector2d: use slice instead of Vec
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-14 15:35:56 +01:00
7f7dffe686
day(13): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-13 16:30:54 +01:00
6beaf1606c
day(12): refactor
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-12 10:47:56 +01:00
ce35175ccb
day(12): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-12 10:31:14 +01:00
fabef3ee41
vector2d: fix a silly typo
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-12 10:30:39 +01:00
837a579827
day(11): refactor simulation
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-11 14:27:03 +01:00
d56154f5c2
day(11): refactor parsing
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-11 14:23:02 +01:00
585e27eed9
day(11): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-11 13:43:05 +01:00
9ff562eef9
solution: allow running sample as binary
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-11 13:42:17 +01:00
1b3394fd94
day(10): refactor a bit more
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-10 14:08:28 +01:00
6afe8c41cc
day(10): refactor and fix tests
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-10 13:38:16 +01:00
357888e311
day(10): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-10 12:51:01 +01:00
f1c4785890
day(09): refactor
• Implement ‹new› for ‹Instruction›
• Pass ‹visited› instead of returning and consuming

Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-09 12:20:29 +01:00
d7d3a8f889
day(09): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-09 12:16:10 +01:00
3219400a73
vector2d: implement subtraction of vectors
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-09 12:15:40 +01:00
cb82cbb433
refactor: use generated boilerplate from lib
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 22:45:13 +01:00
f53be47327
solution: adjust after a refactor
• publicly export reused imports
• deduce string with the day from the typename
• parse sample separately in the tests
  · reason: thread safety when running tests

Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 22:36:58 +01:00
10ecf19590
solution: factor out common functionality
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 21:50:50 +01:00
4b97615e6a
day(08): refactor with ‹Vector2D›
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 16:04:16 +01:00
fa7cc5c241
vector2d: implement few traits and helpers
• Derive ordering
• Implement indexing over 2D Vec with a ‹Vector2D›
• Implement boundary checks for ‹Vector2D› indices over 2D Vec
• Implement ‹swap› on ‹Vector2D›
• Implement dot product and scalar product for ‹Vector2D›

Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 16:02:14 +01:00
7b364e35a3
day(08): address DRY
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 12:50:14 +01:00
e419087f1c
day(08): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-08 12:03:57 +01:00
c975a73f7a
cargo: update and remove ‹thiserror›
• add ‹regex›
• add ‹lazy_static›
• remove ‹thiserror›

Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-07 22:56:22 +01:00
59c5970ae1
env: don't print full backtrace
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-07 14:51:11 +01:00
b574bc6999
day(07): remove debugs
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-07 14:50:55 +01:00
b3b26cd6a9
day(07): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-07 14:41:42 +01:00
33185bdae3
day(06): refactor
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-06 10:15:19 +01:00
65ac67b459
day(06): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-06 10:08:24 +01:00
4bbb98661c
day(05): refactor
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-05 11:31:44 +01:00
95df0a175e
day(05): add initial version
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-05 11:24:15 +01:00
6199872dcd
ci: disable docs and pages
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-04 22:15:45 +01:00
da7c05bd1b
day(04): refactor
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-04 14:37:18 +01:00
3a30260c85
day(04): add initial solution
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-12-04 14:34:38 +01:00