Thanks,
I think that is because im a beginner which has to learn a lot.
May I have a hint how to read the data as as Dictonary. Right now
I use a OrderedCollection for that.
I read in the data like this :
lines := 'inputDay3.tx
The data set AoC gave me for problem 3 has 1353 claims.
The brute force way is to make your x->(y->count) map
and then walk over it counting the number of counts > 1,
n := 0.
map do: [:row |
row do: [:count |
count > 1 ifTrue: [n := n+1]]].
On Wed, 5 Dec 2018 at 11:06, Roelof
First, this is a computational geometry problem, as is the second part.
If this were a serious problem or had a huge amount of data, we would
be looking for a good data structure for holding a collection of
rectangles. We might consider quad-trees, k-d-trees, R-trees, ...
With such a data structur
A claim is a claim ID + a rectangle.
"If the Elves all proceed with their own plans, none of them will have
enough fabric.
How many square inches of fabric are within two or more claims?" <---
actual question.
units are inches.
So, question translates to:
"What is the total area of rectangle i
Thanks I found that out already.
Now trying to understand what they mean with this exactly
If the Elves all proceed with their own plans, none of them will have enough fabric. How many square inches of fabric are within two or more claims?
They give some 1300
On Wed, 5 Dec 2018 at 00:45, Roelof Wobben wrote:
> so like this ?
>
> so first the intersect between rectangle1 and rectangle2
> store it
> and then the intersection between the stored one and rectangle3
> and so on
> then its time to look how I must define a rectangle when I know the
> starting
so like this ?
so first the intersect between
rectangle1 and rectangle2
store it
and then the intersection between
the stored one and rectangle3
Use Rectangle class and intersect: method?
On Tue, Dec 4, 2018 at 5:07 PM Roelof Wobben wrote:
> Hello,
>
> For adventofCode I had to write some code that calculates the overlap that
> multiple rectangles have.
>
> Fo far I have it working for 1 rectangle but I do not like the code
> because
Hello,
For adventofCode I had to write some code that calculates the
overlap that multiple rectangles have.
Fo far I have it working for 1 rectangle but I do not like the code
because of the nested loops.
Can I make this more the pharo way
Co