Level Gridmancer : share your best score


#1

Hello coders,
I begin, I sent a solution (rather simple) implemented with at the end 33 rectangles.

I think we can do 28 rectangles, but it’s more complicated.

And you ? Have you beat 40 rectangles ?

Share your score !


#2

I’ve got a solution that can do 29 without overlaps or 26 if overlaps allowed. For a while I thought 28 was possible, but not sure now. I think 29 and 26 are probably the respective optimums, however happy to be proven wrong.


#3

33 here! For many of the solutions submitted, it’s interesting to think about what the algorithm would do were the map to be rotated 90˚. In this case many of the solutions that got 30, and some that got 29, would get 33, and my solution would get 30. I’ll have fun putting the submissions through some more level configurations at some point to see which ones handle well in all cases.


#4

I managed 30. Not to be off topic, but how do you submit a solution? Just email it?


#5

Yeah, it’s a bit janky right now. Just go to Gridmancer, enable multiplayer, copy your multiplayer link, and put that in a contact form. It also helps to indicate whether you want us to work to find you job opportunities so we know whether to ask you for the info we need to find stuff you’d go for.


#6

Well… I know you can get to 29 rectangles… and I did it on paper lol, I do have an algorithm but I’m rather slow at getting it implemented :slight_smile:

Edit: I have been corrected, 29 rectangles seems to be the best possible score, I previously missed the middle 2 and got 28.


#7

I’m pretty sure 28 is not possible without overlapping them–could it be that the paper version had the walls placed slightly differently?

This is one way to hit 29, for reference.


#8

Whoops, I totally missed the pair of coins in the middle. So, yea 29 :slight_smile:


#9

Ohh ! me too :frowning:
I missed the 2 on the middle… so, ok it’s 29


#10

Yeah, I was trying to be tricky!


#11

A little bit off topic, but is there a way for me to write my own custom function/method? I’d like to write a function to determine if a given point is inside an existing rectangle, but I get errors when trying to define my own function/method.

I’d rather not have to rewrite that block of code over and over again, but I guess I could use an immediately invoked function expression


#12

Check out the Guide at the top of Gridmancer, under the “Using this” tab, for examples of how to define functions that can still access this. (There are a couple quirks in our transpiler that you have to work around.)

A little longer term, we’re thinking something like this for player-defined spells.


#14

All right, just completed the level, and using the optimal number of rectangles at 29, as well! Here’s a screenshot:

I’ve also sent a message via the contact form!

Also, I tried my algorithm on a rotated map, and it got 30 rectangles. I might try some further tweaking to get 29 both ways.


#15

29 rectangles here. My solution ends up looking fairly similar to Nick’s.

Also tried rotating it like what Mercury did. My rectangles were placed fairly differently, but still ended up with 29 overall :slight_smile: (And no, I’m not forgetting to count the two little spaces by themselves in the middle) I’d share an image, but I’m a new user…


#16

This is good, enjoyed it a lot. Still working to simplify, started by just making lots of tall rectangles. Ended with 56 I think, need to add width as well. My students had a lot of fun with this for Hour of Code, I think some will continue on with the harder levels.

I think I’m going to have to try to figure out making my own function or the overlap thing is going to be crazy ugly!


#17

I just wrote the code that solved the problem using 29 rectangles.

However, I see ‘goals incomplete’ message.

Is anything else I should do except adding all of the 29 non-overlapping rectangles using addRect(…) method?

Btw, I’m having trouble in finding how to upload the screenshot :slight_smile:

Cheers


#18

There aren’t any goals for this one, unfortunately!

Discourse may not be letting you upload an image until you have posted a certain number of times; that could be, anyway.


#19

Thanks for the answer Nick.

Then, should I paste the code here (in case someone wanted to see/discuss it) or something?

What’s the common practice here?


#20

Ah, I see now I can upload the images, thanks Nick!

And here is the screenshot of the solution:


#21

Btw,
I have other code that I wrote for solving the same problem. The code is capable of solving the gridmancer problem in parallel.
But the code cannot be run in codecombat because i used a lot of javascript contructors to create objects.
Any suggestions?
I don’t mind sending you the code that I’m talking about if you like to discuss it with me?

Cheers