ASPP / pelita_template

Default template to get started with the Pelita game.
3 stars 25 forks source link

Add pictures that explain how the noise works #13

Closed Debilski closed 5 years ago

Debilski commented 5 years ago

We should clarify the noise with a picture in the template and maybe even have a more extensive visualisation in the normal documentation, that explains how noise affects the bots in a team differently (also in a border situation etc.). Those graphics should be normative. When we find that the algorithm disagrees, then the algorithm should be changed.

otizonaizit commented 5 years ago

any progress on this? I question the usefulness of having it. The wording is quite clear now:

bot.enemy[0].is_noisy if the enemy bot is located more than 5 squares away from your bot, then its position bot.enemy[0].position will not be exact. A uniformly distributed noise between -5 and +5 squares will be added to it instead. The distance of your bot from the enemy bot is measured in grid space, i.e. if your bot is in (Bx, By) and the enemy bot is in (Ex, Ey), the distance will be abs(Bx-Ex) + abs(By-Ey). An example of using the is_noisy property is given in demo05_basic_defender.py.

Debilski commented 5 years ago

If the wording is clear then why did I have to answer questions how the noise works last year (and every year before that)? (Follow-up question: have you actually verified that this is what our algorithm is doing? Because I haven’t. I only know that our algorithm is doing something.)

I’ll take care of checking it and of adding the pictures.

lschwetlick commented 5 years ago

I made a notebook explaining it in this

otizonaizit commented 5 years ago

If the wording is clear then why did I have to answer questions how the noise works last year

Because people do not ever read up to the end of the documentation. This year tell them where to find the answer.

(and every year before that)?

because in previous years the explanation was lost in the docs, and was full of graphics, yes, explaining all possible kind of distances that you can define on a maze, the pros and cons of each of them, with arrows and mini-layouts and all that. I am not even sure it was said anywhere clearly what is the distance that was used by the noiser. Result: you still got questions after writing 5 pages of docs about it :-P

(Follow-up question: have ou actually verified that this is what our algorithm is doing? Because I haven’t. I only know that our algorithm is doing something.)

You keep on saying this enigmatic sentences, like there were some terrible secret in the noiser code. I just had (the n-th) look at the code: I don't understand your skepsis. The thing is doing exactly what it says in the docs. The only thing that the docs do not explain (I don't think they should anyway, this level of detail is only confusing) is what happens when the noisy region falls partly outside of the maze. The algorithm in the noiser simply discards those part of the noisy region that fall outside of the maze, so effectively you have a skewed noise distribution, yes, but why exactly would you care?

Or am I missing something serious? Sure, the code could be optimized in several parts, and maybe we should, if and when you publish your profiling results, but it is readable.

I’ll take care of checking it and of adding the pictures.

Good, check and report back. I am still very very skeptical about the pictures, but I am happy to be outvoted if someone else agrees with you.

Debilski commented 5 years ago

You keep on saying this enigmatic sentences, like there were some terrible secret in the noiser code.

(I don’t have too much time this evening.) My point is: yes, some students think the noiser is somewhat secret and mysterious, so I think a picture will help more than a mathematical description. The second thing: Sure, the noiser should be the easiest thing in the world, but please remember that the noiser had been (slightly) wrong for years and it had still been wrong after the re-write, so I’d be careful …

otizonaizit commented 5 years ago

@Debilski : if you are not working on it, leave it to me. I want to have a deep look at the noiser, I'll see if some refactoring is appropriate and add some tests. This should not affect your documenting efforts, as the algorithm and its results won't change.

Debilski commented 5 years ago

Noise from the perspective of red-1. Blue can appear on any of the purple squares. I can try to adjust the position of the bots for more pedagogic situations, but the some of the grid ‘squares’ are one pixel larger than others, so it is a little more complicated than I would’ve thought.

noise

Debilski commented 5 years ago

I can also add the ‘radius of visibility’ around red-1.

otizonaizit commented 5 years ago

That's very nice!

Add the radius of visibility for red-0 towards bot blue-0, so it is clear that it falls within the radius of visibility!

One could add the case where the blue-1 is near the outer border, so you see that the part of the "diamond" which falls out of the maze gets ignored, but that must not absolutely be...

On 14 August 2019 18:29:54 CEST, Rike-Benjamin Schuppner notifications@github.com wrote:

I can also add the ‘radius of visibility’ around red-1.>

-- > You are receiving this because you commented.> Reply to this email directly or view it on GitHub:> https://github.com/ASPP/pelita_template/issues/13#issuecomment-521319758

otizonaizit commented 5 years ago

Sorry, I messed up the indices. Yes, add the radius of visibility for the red bot that sees the blue bot exactly. That is a good idea!

On 14 August 2019 18:41:53 CEST, Tiziano Zito tiz@posteo.net wrote:

That's very nice!

Add the radius of visibility for red-0 towards bot blue-0, so it is clear that it falls within the radius of visibility!

One could add the case where the blue-1 is near the outer border, so you see that the part of the "diamond" which falls out of the maze gets ignored, but that must not absolutely be...

On 14 August 2019 18:29:54 CEST, Rike-Benjamin Schuppner notifications@github.com wrote:

I can also add the ‘radius of visibility’ around red-1.>

-- > You are receiving this because you commented.> Reply to this email directly or view it on GitHub:> https://github.com/ASPP/pelita_template/issues/13#issuecomment-521319758

Debilski commented 5 years ago

I just noticed though, that the walls are forbidden noise positions. I’ll remove the colour from these.

Debilski commented 5 years ago

noise1

otizonaizit commented 5 years ago

Looks good! What about the text? That's also not so easy...

On 14 August 2019 18:49:51 CEST, Rike-Benjamin Schuppner notifications@github.com wrote:

noise1

Debilski commented 5 years ago

Working on it but I’m busy this evening.

Am 14.08.2019 um 19:28 schrieb Tiziano Zito notifications@github.com:

Looks good! What about the text? That's also not so easy...

On 14 August 2019 18:49:51 CEST, Rike-Benjamin Schuppner notifications@github.com wrote:

noise1 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Debilski commented 5 years ago

I think I’d go more in this direction an skip the math completely:

bot.enemy[0].is_noisy if the enemy bot is located more than 5 squares away from your bot, then its position bot.enemy[0].position will not be exact. Instead, you will be shown a position that is located up to 5 squares away from the original position (moving either horizontally or vertically).

Am 14.08.2019 um 19:28 schrieb Tiziano Zito notifications@github.com:

Looks good! What about the text? That's also not so easy...

On 14 August 2019 18:49:51 CEST, Rike-Benjamin Schuppner notifications@github.com wrote:

noise1 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lschwetlick commented 5 years ago

In the picture where you leave out the walls the colors are really similar. Maybe make the noise slightly different from the greyed out walls.

In the text let's make it clear that the noise is in steps and not coordinates. Maybe something like:

bot.enemy[0].is_noisy: if the enemy bot is located more than 5 steps away from your bot, then its position bot.enemy[0].position will not be exact. Instead, the enemy position you see will be up to 5 bot-steps away from the enemy's actual position (i.e. the enemy can show up in any field it could have reached in 5 steps or less). The enemy bot's is_noisy flag will be set to True. Noisy positions are never inaccessible, such as inside walls or outside the maze.

lschwetlick commented 5 years ago

Also, if its doable, I'd suggest showing the red bot's visible range as a red (dotted?) outline, not as a filled shape. That might help differentiate the two cases.

Debilski commented 5 years ago

Hmm, but it is coordinates and not steps. If we say bot steps, I think it will mean that the noise has to walk around walls.

Yeah, I’ll toy with the photoshop template a little more tomorrow and see how it looks with different patterns.

lschwetlick commented 5 years ago

Okay, but then the noise is actually really hard to describe because it works neither in bot space nor in coordinate space but something in between somehow.

bot.enemy[0].is_noisy: if the enemy bot is located more than 5 coordinate steps away from your bot, then its position bot.enemy[0].position will not be exact. Instead, the enemy position you see will be up to 5 coordinate steps away from the enemy's actual position. Coordinate steps are steps of manhattan distance in the maze. The enemy bot's is_noisy flag will be set to True. Noisy positions are never inaccessible, such as inside walls or outside the maze.

Debilski commented 5 years ago

I wouldn’t mention the manhattan distance. No-one knows what it is unless we also explain that. Plus we should keep it as short as possible or it will not be read.

bot.enemy[0].is_noisy: if the enemy bot is located more than 5 coordinate steps away from your bot, then its position bot.enemy[0].position will not be exact. Instead, the enemy position you see will be up to 5 coordinate steps away from the enemy's actual position. (Coordinate steps are all horizontal or vertical movements.) The enemy bot's is_noisy flag will be set to True. Noisy positions are never inaccessible, such as inside walls or outside the maze.

lschwetlick commented 5 years ago

Okay, agreed. That version sounds good to me!

otizonaizit commented 5 years ago

We can use the picture to explain, no? I wouldn't use the word "step", because it means so many different things in this context. I would try to refer to the picture for the details, without trying to explain them with the result of making the text harder to read. What about something along these lines:

bot.enemy[0].is_noisy: your bot has a sight-radius of 5 squares. This means that when an enemy bot is located more than 5 squares away from your bot, bot.enemy[0].position will not be exact and bot.enemy[0].is_noisy will be True. The sight-radius for red bot 1 is the green area in the picture below. Red bot 1 will see the exact position of blue bot 0, because it falls into its sight-radius. Instead, red bot 1 will see blue bot 1 as if it were located in one random legal position up to 5 squares away from its true position (this is the noise-radius, the grey area around blue bot 0 in the picture).

You should use colors in the picture that we can name (I don't know how to name the one you use for the noise now). Also, for the walls, I'd just leave the background white: this conveys better the idea that they don't count, in my opinion.

Debilski commented 5 years ago

Me and the pattern select tool in Photoshop have yet to become good friends.

noise5

otizonaizit commented 5 years ago

Why? It looks nice! Maybe remove the background also from the walls in the sigh-radius zone?

But otherwise you can always try gimp :-P

Debilski commented 5 years ago

My metric was time times effort. And it was much much higher than it should’ve been. :)

Debilski commented 5 years ago

Food was gone. Pro-tip (ok, probably amateur tip): Lock transparent pixels!

noise-7

otizonaizit commented 5 years ago

Looks good now! What do you think of my explanation text above?

Debilski commented 5 years ago

Maybe put: if it were located in one random legal position (up to) 5 squares away, to make it clear that it can also be less.

Otherwise, I like it. The only drawback is that now it is only understandable with a picture. I would have done it in two parts probably. Use the shorter version of @lschwetlick and me for the text and have an additional explanation with picture below. But we can keep it that way.

otizonaizit commented 5 years ago

If you make a PR with just the picture (maybe call it pelita-noise.png?) I will take care of integrating it into the docs.

otizonaizit commented 5 years ago

Do you have a suggestion how to name the colors of the noise and sight areas? The noise one can be called "blue-striped". The sight one? "red-dotted"?

Debilski commented 5 years ago

Yeah, I don’t know anything better. Tomorrow we’ll have a tiny pelita session at work. I can ask for better opinions.