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

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
solutions on github, so I pushed mine here: https://github.com/ssvb/adventofcode/blob/main/2023/day01/trebuchet.d Maybe later I'll also publish all my D solutions for older puzzles from Advent of Code 2022, but that code needs a bit of cleanup.

Re: Advent of Code 2023

2023-12-03 Thread Siarhei Siamashka via Digitalmars-d-learn
quot; is replaced by "two2two" and so on). And after such search & replace is complete, the whole task becomes the same as the already solved part1. Such approach makes the code slower, but the code is simpler and faster to implement. A useful tradeoff for the Advent of Code puzzles.

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

Re: Advent of Code 2022

2022-12-10 Thread Sergey via Digitalmars-d-learn
On Saturday, 10 December 2022 at 20:49:03 UTC, Christian Köstlin wrote: Is anybody participating with dlang in the advent of code 22? It would be interesting to discuss dlang specific things from the puzzles. Kind regards, Christian https://forum.dlang.org/thread/adkugbopvfbcycknx

Re: Advent of Code 2022

2022-12-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 10 December 2022 at 20:49:03 UTC, Christian Köstlin wrote: Is anybody participating with dlang in the advent of code 22? It would be interesting to discuss dlang specific things from the puzzles. Mine: https://github.com/schveiguy/adventofcode -Steve

Advent of Code 2022

2022-12-10 Thread Christian Köstlin via Digitalmars-d-learn
Is anybody participating with dlang in the advent of code 22? It would be interesting to discuss dlang specific things from the puzzles. Kind regards, Christian

Re: Advent of Code

2015-12-09 Thread Ola Fosheim Grøstad via Digitalmars-d
On Wednesday, 9 December 2015 at 02:48:31 UTC, Sean Campbell wrote: how is this D speek. it's far shorter and easier to read if you use writefln("floor %s",input.count('(') - input.count(')')); Yes, I don't find chaining of methods all that easy to read either, but you can do less work by

Re: Advent of Code

2015-12-08 Thread w0rp via Digitalmars-d
Thanks for suggesting this. This is fun! Although, I've taken on quite a different challenge myself. I'm computing all of the answers only by using my console in Firefox. I'm actually getting through these pretty quickly. (It helps to know some ES5 and ES6.) I can imagine the D code already,

Re: Advent of Code

2015-12-08 Thread Sean Campbell via Digitalmars-d
On Wednesday, 2 December 2015 at 08:45:11 UTC, Adrian Matoga wrote: On Wednesday, 2 December 2015 at 03:50:20 UTC, Charles wrote: (..) auto input = "arbitrarily long string of '(' and ')'"; int floor; foreach(movement; input) floor += (movement == '(' ? 1 : -1);

Re: Advent of Code

2015-12-02 Thread Adrian Matoga via Digitalmars-d
On Wednesday, 2 December 2015 at 03:50:20 UTC, Charles wrote: (..) auto input = "arbitrarily long string of '(' and ')'"; int floor; foreach(movement; input) floor += (movement == '(' ? 1 : -1); writeln(floor); Speak D to me, please. stdin.byLine.front.map!(a =>

Re: Advent of Code

2015-12-01 Thread Ali Çehreli via Digitalmars-d
On 12/01/2015 08:08 AM, Regan Heath wrote: Hi all, Long time since I read/posted here but I saw this and thought it might be good PR for D: http://adventofcode.com/ Should also be fun. Ciao, Regan My visit was short due to this: To play, please identify yourself via one of these

Re: Advent of Code

2015-12-01 Thread drug via Digitalmars-d
On 02.12.2015 06:50, Charles wrote: On Tuesday, 1 December 2015 at 22:57:38 UTC, Ali Çehreli wrote: My visit was short due to this: To play, please identify yourself via one of these services: [github] [google] [twitter] [reddit] Ali I was the same way earlier, but reddit doesn't need

Re: Advent of Code

2015-12-01 Thread Ali Çehreli via Digitalmars-d
On 12/01/2015 07:50 PM, Charles wrote: > On Tuesday, 1 December 2015 at 22:57:38 UTC, Ali Çehreli wrote: >> My visit was short due to this: >> >> To play, please identify yourself via one of these services: >> >> [github] [google] [twitter] [reddit] >> >> Ali > > I was the same way earlier, but

Re: Advent of Code

2015-12-01 Thread Charles via Digitalmars-d
On Tuesday, 1 December 2015 at 22:57:38 UTC, Ali Çehreli wrote: My visit was short due to this: To play, please identify yourself via one of these services: [github] [google] [twitter] [reddit] Ali I was the same way earlier, but reddit doesn't need personal information, so you can just

Advent of Code

2015-12-01 Thread Regan Heath via Digitalmars-d
Hi all, Long time since I read/posted here but I saw this and thought it might be good PR for D: http://adventofcode.com/ Should also be fun. Ciao, Regan