Re: Advent of Code 2023

2023-12-14 Thread Siarhei Siamashka via Digitalmars-d-learn
On Sunday, 3 December 2023 at 15:04:09 UTC, Siarhei Siamashka wrote: On Saturday, 2 December 2023 at 14:35:19 UTC, Sergey wrote: Some other solutions that could be worth to check: https://github.com/andrewlalis/AdventOfCode2023/blob/main/day_1/solution.d

Re: Advent of Code 2023

2023-12-05 Thread Siarhei Siamashka via Digitalmars-d-learn
On Sunday, 3 December 2023 at 18:56:32 UTC, Johannes Miesenhardt wrote: On Sunday, 3 December 2023 at 14:51:37 UTC, Siarhei Siamashka wrote: [...] Thanks, this is super helpful. I have one other question, in the solution you posted and also the one I posted in the discord today. I was

Re: Advent of Code 2023

2023-12-03 Thread Julian Fondren via Digitalmars-d-learn
On Monday, 4 December 2023 at 03:50:47 UTC, Siarhei Siamashka wrote: On Monday, 4 December 2023 at 03:07:07 UTC, matheus wrote: import std.stdio; import std.algorithm; import std.array; import std.format; import std.conv; import std.string; ... Why do you do multiple imports instead of one

Re: Advent of Code 2023

2023-12-03 Thread Siarhei Siamashka via Digitalmars-d-learn
On Monday, 4 December 2023 at 03:07:07 UTC, matheus wrote: import std.stdio; import std.algorithm; import std.array; import std.format; import std.conv; import std.string; ... Why do you do multiple imports instead of one import std;? I means is there any difference in CT? The code indeed

Re: Advent of Code 2023

2023-12-03 Thread matheus via Digitalmars-d-learn
On Saturday, 2 December 2023 at 13:33:33 UTC, Johannes Miesenhardt wrote: On Friday, 1 December 2023 at 01:01:31 UTC, Siarhei Siamashka wrote: Advent of Code 2023 starts in a few hours from now. I suggest to discuss D language solutions here. But to avoid spoilers, it's best to do this with a

Re: Advent of Code 2023

2023-12-03 Thread Julian Fondren via Digitalmars-d-learn
On Sunday, 3 December 2023 at 23:44:43 UTC, Julian Fondren wrote: ```d if (str[i..$].startsWith(key)) return value; ``` Corrected. The other doesn't compile, unless you never run it with -version=Part2 ...

Re: Advent of Code 2023

2023-12-03 Thread Julian Fondren via Digitalmars-d-learn
On Saturday, 2 December 2023 at 13:33:33 UTC, Johannes Miesenhardt wrote: I am a bloody beginner so if there are any things that are very wrong with this please point them out. The fact that I need a template for accepting both a string and a char[] is very weird but I went with it. I am also

Re: Advent of Code 2023

2023-12-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 3 December 2023 at 18:56:32 UTC, Johannes Miesenhardt wrote: On Sunday, 3 December 2023 at 14:51:37 UTC, Siarhei Siamashka wrote: [...] Thanks, this is super helpful. I have one other question, in the solution you posted and also the one I posted in the discord today. I was

Re: Advent of Code 2023

2023-12-03 Thread Johannes Miesenhardt via Digitalmars-d-learn
On Sunday, 3 December 2023 at 14:51:37 UTC, Siarhei Siamashka wrote: [...] Thanks, this is super helpful. I have one other question, in the solution you posted and also the one I posted in the discord today. I was required to use byLineCopy. I first used byLine but I for some reason that I

Re: Advent of Code 2023

2023-12-03 Thread Siarhei Siamashka via Digitalmars-d-learn
On Saturday, 2 December 2023 at 14:35:19 UTC, Sergey wrote: Some other solutions that could be worth to check: https://github.com/andrewlalis/AdventOfCode2023/blob/main/day_1/solution.d https://github.com/schveiguy/adventofcode/blob/master/2023/day1/trebuchet.d It's indeed a good idea to have

Re: Advent of Code 2023

2023-12-03 Thread Siarhei Siamashka via Digitalmars-d-learn
On Saturday, 2 December 2023 at 13:33:33 UTC, Johannes Miesenhardt wrote: I am a bloody beginner so if there are any things that are very wrong with this please point them out. Everything is fine as long as it works and does the job. The fact that I need a template for accepting both a string

Re: Advent of Code 2023

2023-12-02 Thread Sergey via Digitalmars-d-learn
On Saturday, 2 December 2023 at 13:33:33 UTC, Johannes Miesenhardt wrote: Day 1 solution here, since I swap them out based on a runtime argument. In the Discord server we also have a topic about AoC2023. So feel free to join it as well. Some other solutions that could be worth to check:

Re: Advent of Code 2023

2023-12-02 Thread Johannes Miesenhardt via Digitalmars-d-learn
On Friday, 1 December 2023 at 01:01:31 UTC, Siarhei Siamashka wrote: Advent of Code 2023 starts in a few hours from now. I suggest to discuss D language solutions here. But to avoid spoilers, it's best to do this with a 24h delay after each puzzle is published. Day 1 solution ```d version =

Re: Advent of Code 2023

2023-12-01 Thread Sergey via Digitalmars-d-learn
On Friday, 1 December 2023 at 01:01:31 UTC, Siarhei Siamashka wrote: Advent of Code 2023 starts in a few hours from now. I suggest to discuss D language solutions here. But to avoid spoilers, it's best to do this with a 24h delay after each puzzle is published. Hi Siarhei. Nice to see that