EntelectChallenge / 2020-Overdrive

Main repository for Entelect Challenge 2020
12 stars 27 forks source link

Hitting mud penalty incorrectly calculated #35

Closed kobus-v-schoor closed 4 years ago

kobus-v-schoor commented 4 years ago

Hi,

Currently there still seems to be a bug where the speed penalty for hitting mud isn't correctly calculated although it seems to be fairly rare. I've only been able to reproduce it twice (current release at the time of writing is 2020.01.4, so after the previous fix where multiple hits weren't counted).

For the first example a TURN_LEFT is issued while boosting. The expected speed penalty would be 15->9->8->6->3 (hitting 4 mud blocks) but in this case the resulting speed was 6.

==============================
round:32
player: id:1 position: y:3 x:290 speed:15 state:NOTHING boosting:true boost-counter:4 powerups: OIL:5, BOOST:3
opponent: id:2 position: y:2 x:178 speed:6

[░░░░»░░░▓░▓░░░░░░░▓░░░░░░░]
[░░░░░▓░░░░░▓▓▓░░░░░░░░░░░░]
[░░░░░1░░░░░░▓░░░░░░░░▓░░░░]
[░░░░░░░░░░░░░░░░▓░▓░░░▓░░▓]
==============================

CMD: TURN_LEFT

==============================
round:33
player: id:1 position: y:2 x:304 speed:6 state:HIT_MUD boosting:false boost-counter:0 powerups: OIL:5, BOOST:3
opponent: id:2 position: y:3 x:183 speed:6

[░░░░▓░░░░░░░░░░░░░░░░░░░░░]
[░░░░░1░░░░░░░░▓░▓░░░░░░░░▓]
[░░░░░░░▓░░░░░░░░░░░░▓░░░░░]
[░░▓░▓░░░▓░░▓░░░░Φ░░░░░░░░»]
==============================

In the next example a TURN_RIGHT command was issued and there is an expected penalty of hitting one mud block so the speed should be 8->6. The actual resulting speed stayed 8.

==============================
round:133
player: id:1 position: y:3 x:1435 speed:8 state:TURNING_RIGHT boosting:false boost-counter:0 powerups: OIL:6
opponent: id:2 position: y:3 x:621 speed:3

[░░░░░░░░░░░░░░░░»░░░░░░░░▓]
[░░░░░░░░░░░░░▓░░▓░░░░░»░░░]
[░░░░░1░░░░░░░░░░░▓░░░░░░▓░]
[░░░░░▓░»░░░░░▓░░░░░»░░░░░░]
==============================

CMD: TURN_RIGHT

==============================
round:134
player: id:1 position: y:4 x:1442 speed:8 state:TURNING_RIGHT boosting:false boost-counter:0 powerups: OIL:6, BOOST:1
opponent: id:2 position: y:2 x:623 speed:3

[░░░░░░░░░»░░░░░░░░▓░░▓░░░░]
[░░░░░░▓░░▓░░░░░»░░░░░░▓░░▓]
[░░░░░░░░░░▓░░░░░░▓░»░░░░░░]
[»░░░░1▓░░░░░»░░░░░░░░░▓░░░]
==============================

In both examples the final endpoint was calculated correctly and in the second example the boost pickup was successful. In the first example the player was boosting and in the second one not, so the only common denominator between the two examples were that both were turning.

If you need more details please let me know.

kobus-v-schoor commented 4 years ago

EDIT: please see end of comment, this example is irrelevant and the game-engine behaved correctly in this case.

I've been able to reproduce the issue multiple times now and every time it occurred it was during either a left or a right turn. I've also been able to once find the issue during a boost (expected speed 15->9->8->6->3->0, actual was 3):

===============================
round:59
player: id:1 position: y:2 x:659 speed:8 state:TURNING_LEFT boosting:false boost-counter:0 powerups: OIL:5, BOOST:4
opponent: id:2 position: y:3 x:314 speed:8

[░░░░░░░░░░░░░░░░░░░▓░░▓░░░]
[░░░░░1░░░▓░▓▓░░▓▓░░░░░░░░░]
[░░▓░░░░░░░░░░░░░░░▓░░░░▓░░]
[▓░░░░░░░░▓░░░░░░░░░░▓░░░░░]
===============================

CMD: USE_BOOST

===============================
round:60
player: id:1 position: y:2 x:674 speed:3 state:HIT_MUD boosting:false boost-counter:0 powerups: OIL:5, BOOST:3
opponent: id:2 position: y:2 x:321 speed:3

[░░░░▓░░▓░░░░░░░░░▓░░»░░░░░]
[▓▓░░░1░░░░░░░░░░▓░░░▓░░░░░]
[░░░▓░░░░▓░░░░░▓░░▓░░░░░░░░]
[░░░░░▓░░░░░░▓░░░░░░░░▓░░░░]
===============================

EDIT: This specific example is irrelevant, this behavior seems to be correct since the mud blocks should not slow you down further than SPEED_1 (3) as explained here. I'm leaving this comment as in case it helps someone. The other examples mentioned in this issue are relevant though.

GawieJooste commented 4 years ago

I also observed the same issue when a powerup is next to the car, and the TURN command is issued, the powerup will not be picked up. Just like the mud is missed in the original post by @kobus-v-schoor.

This behaviour is unexpected since the game rules state: "The first block the bot moves will be directly to the left/right, and then the rest of the blocks directly forward in the new lane."

demaniak commented 4 years ago

Could the problem possibly related to this?

Current master version: here

I might be missing something, but it feels like the lane value should also be modified there when turning?

E4M9i commented 4 years ago

The issue also appears when you accelerate and the mud in your way won't impact and speed remains as was if it was maximum.