From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.0 required=3.0 tests=BAYES_20,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: Advent of Code day 5 Date: Sun, 6 Dec 2020 15:09:51 +0100 Organization: A noiseless patient Spider Message-ID: References: <861rg4gv6j.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 6 Dec 2020 14:09:52 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="d92327fa4c72f27769f0cdbfbf70dd61"; logging-data="13276"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ehATznYxko+XWP3wZo36p" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 Cancel-Lock: sha1:Cs3ci4xx+oKkBAvZPGGJdg++B7s= In-Reply-To: Content-Language: sv Xref: reader02.eternal-september.org comp.lang.ada:60749 List-Id: Den 2020-12-06 kl. 10:14, skrev Jeffrey R. Carter: > On 12/5/20 3:54 PM, Stephen Leake wrote: >> that was trivial > > I'm curious: Did everyone do this by treating the input as a coded > 10-digit binary number, or did some take another approach? > I uses it as binary 7 +3, but I did the calculaions through the shell text utilities First I decoded and printed all rows, seats and ids like loop file and decode ... Text_Io.Put_Line (Row'Img & Seat'Img & Id'Img); end loop and ran it through cut/sort/uniq day_05 | cut -d' ' -f2 | sort -n | uniq -c which gave a list on the terminal like ... 8 61 8 62 8 63 8 64 8 65 8 66 8 67 8 68 8 69 7 70 8 71 8 72 8 73 8 74 ... and that found my row then I ran it with grep "^ 70" and got day_05 | grep "^ 70" 70 3 563 70 6 566 70 5 565 70 0 560 70 1 561 70 4 564 70 7 567 and saw what seat is free in the end I saved and printed the max seatid as well but yes , the encoding was with parsing as binary -- Björn