Piet Souris

Bartender
+ Follow
since Mar 08, 2009
Merit badge: grant badges
Forum Moderator
Piet Souris currently moderates these forums:
For More
Netherlands
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Piet Souris

This is what I sometimes do, to make it easy on me (instead of using ordinals):
1 week ago
Unfortunately, also this AOC seems to have died silently. Well, at least give day 16 a try, that one I liked a lot.
To generalize Norms example a little:

You can see the re-use of thread 3.
4 weeks ago
I have no experience here, but my first idea would be the use of the method "getStringBounds" that gives you a Rectangle2D that you can use together with a left margin, to calculate the width of a text in pixels.
1 month ago
The robot can move up if there is nothing above it, or if there is a block above, when that block can move up. And when can a block move up? Do I smell recursion? Se the code I gave. I refactored it while pasting, never a good thing to do, but you may get an idea.
Do you mean by 'proceeding' 'following'? Here is a third version, after Careys and Rons code:
1 month ago

Liutauras Vilda wrote:Resolved part 1, but part 2 looks nasty at this point.


moving left and right are no problem, I showed the routine that I have, but moving up and down is not so easy. I used a pretty laborious method in my Blok-class (int row, int cl // column left, int cr // column right)

and I call this method from a method in my robot-class
But then there is a small chance that one or more of these spoil your christmas tree. My more than 8000 forward steps took just a fraction of a second, so backwards is fast enough.
It returns an empty list if there are no bloks on the left side. But a blok.moveLeft does nothing if the blok cannot move. That list is sorted, so the bloks can be moved starting from the left.
I used regex for part A, but that was certainly not the quickest way! For part B, I rewrote the lot, and could come up with this solution:

That looks short, but it was pretty much laborious. But maybe it can be done much more simple.
I agree with Tim, starting from the christmas-tree, adding a lot of random robots, determining a number between 5000 and 15000, and work back.
hi  Milo,

welcome to the Ranch!

A '\' has a special meaning in a String, it 'escapes'the next character. If you want to use a '\', proceed it with another '\', so use: "D:\\M..".

What always works, on any OS, is to use the forward slash, '/'. So use "D:/M...", success guaranteed!
1 month ago
This is my christmas-tree, requiring more than 8000 steps (I rotated 90 degrees):
This part B took me a midday and part of my nightrest.... I was expecting to see the start of the christmastree appearing within the first 30 lines, but whatever I tried to look for: nope. Only just printing out the full lot. Miserable exercise.
No problems whatsoever. Use % to test if solvable.