ChaelCodes / CorneliusCodes

Cornelius, the Corn Snake who codes, is a Rusty Battlesnake Baby.
MIT License
2 stars 5 forks source link

Cornelius wiggles towards food #12

Open ChaelCodes opened 2 years ago

ChaelCodes commented 2 years ago

Description

In the Kyoshi novels, they say the Earthbenders find the Avatar by dividing the earth kingdom in 2, and divining which direction the Avatar is in. Moving in smaller and smaller areas. They don't find Kyoshi though, because she moves, like our food does. Let's evaluate how safe or hazardous an area is, and drive Cornelius that direction!

Caleb-T-Owens commented 2 years ago

we could divide the map up into sectors, then we need to quantify the dangers and benefits of a sector IE If a sector has lots of tail it looses points, as well as having danger tiles it looses points, but if it has food, it also gains points, so corny knows to head in that general direction, in their little wiggly way.

What would need to be thought about: How would we determine sectors programmatically, for larger boards putting 5x5 sectors could work well, but for the 7x7 board, that wouldn't make much sense

ChaelCodes commented 2 years ago

we could divide the map up into sectors, then we need to quantify the dangers and benefits of a sector IE If a sector has lots of tail it looses points, as well as having danger tiles it looses points, but if it has food, it also gains points, so corny knows to head in that general direction, in their little wiggly way.

What would need to be thought about: How would we determine sectors programmatically, for larger boards putting 5x5 sectors could work well, but for the 7x7 board, that wouldn't make much sense

(3 * Food - Hazards)/squares in space? I just made that function up, but it feels right. Also, I wouldn't divide the board by fixed sectors, I'd divide it based on the location of Cornelius's head.

ChaelCodes commented 2 years ago

Also how are you passing this? I wrote it in the middle of the night because I couldn't sleep!

Caleb-T-Owens commented 2 years ago

Also how are you passing this? I wrote it in the middle of the night because I couldn't sleep!

how do you mean passing?

(3 * Food - Hazards)/squares in space?

I think

safty = foodCount - hazards
  where
    hazards = snakeSegmentCount + hazardWallCount

I dont think food needs to be that prioritized, I think avoiding danger could be more important. Maybe 2 * food at most. This is just speculation though, I think we will need to ask Corny to try a few strategies out for us