[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*From*: "migu...@xxxxxxxxxxxxxxxx" <miguelraz@xxxxxxxxxxxxxxxx>*Date*: Wed, 9 Dec 2020 11:41:23 -0800 (PST)*References*: <fa41ccee-b829-4bca-8b48-23a71d863bc2n@googlegroups.com> <5c8c328b-6e44-fc55-4d56-c0afe5cd5f0f@lemmster.de>

Thanks!

I actually took most of the code from the first repo, ran it locally and was pleased, then tried implementing the PlusCal version.

On Wednesday, 9 December 2020 at 13:23:06 UTC-6 Markus Alexander Kuppe wrote:

On 08.12.20 22:19, migu...@xxxxxxxxxxxxxxxx wrote:

>

> Hello all!

> This is my first attempt at seriuosly using PlusCal, and I'm trying to

> solve some small problems to warm up. I tried solving the first Advent

> of Code problem, but my PlusCal is quite rough.

> Any help ?

> The problem is, given a list, find 2 numbers that sum to 2020.

>

>

> ---- MODULE pcal ----

> EXTENDS TLC, Integers, FiniteSets, Sequences

>

> (*--algorithm pcal

> variables

> Sum = 2020,

> Input = <<

> 1511,

> 1112,

> 1958,

> 1778,

> 1769,

> 1946,

> 1800,

> 1911,

> 1821,

> 1886,

> 285,

> 1649,

> 1952,

> 1428,

> 1779,

> 1822,

> 1735

>>>;

>

> begin

> with x \in Input do

> with y \in Input \ {x} do

> assert x + y = Sum;

> end with;

> end with; end algorithm; *)

Hi,

although TLA+ and not PlusCal, it perhaps helps to study the solutions

of Arnaud Bos [1] and Thomas Bracher [2].

Markus

[1] https://github.com/arnaudbos/aoc2020-tla-plus/tree/master/day1

[2] https://github.com/sadraskol/advent-2020/blob/main/Advent1.tla

You received this message because you are subscribed to the Google Groups "tlaplus" group.

To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.

To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/401c19db-f162-4683-9baa-52754055eb5en%40googlegroups.com.

**Follow-Ups**:**Re: [tlaplus] Help with Advent of Code day 01***From:*migu...@xxxxxxxxxxxxxxxx

**References**:**[tlaplus] Help with Advent of Code day 01***From:*migu...@xxxxxxxxxxxxxxxx

**Re: [tlaplus] Help with Advent of Code day 01***From:*Markus Kuppe

- Prev by Date:
**[tlaplus] Notes on understanding fairness concepts** - Next by Date:
**Re: [tlaplus] Help with Advent of Code day 01** - Previous by thread:
**Re: [tlaplus] Help with Advent of Code day 01** - Next by thread:
**Re: [tlaplus] Help with Advent of Code day 01** - Index(es):