changed the last double variables and values to float and add more hints to readme

This commit is contained in:
muebau 2024-05-26 11:01:57 +02:00
parent 5f0c6fce74
commit caf0a5bbe8
4 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ public:
uint8_t fullLines;
uint16_t bumpiness;
uint16_t aggregatedHeight;
double score;
float score;
uint8_t width;
std::vector<uint8_t> lineHights;
@ -57,7 +57,7 @@ public:
this->fullLines = 0;
this->bumpiness = 0;
this->aggregatedHeight = 0;
this->score = -DBL_MAX;
this->score = -FLT_MAX;
}
};

View File

@ -10,7 +10,7 @@ Just activate the usermod with `-D USERMOD_TETRISAI` and the effect will become
## Usage
It is best to set the background color to black, the border color to light grey and the game over color (foreground) to dark grey.
It is best to set the background color to black 🖤, the border color to light grey 🤍, the game over color (foreground) to dark grey 🩶, and color palette to 'Rainbow' 🌈.
### Sliders and boxes

View File

@ -107,7 +107,7 @@ public:
rating->score = (aHeight * (rating->aggregatedHeight)) + (fullLines * (rating->fullLines)) + (holes * (rating->holes)) + (bumpiness * (rating->bumpiness));
}
TetrisAI(): TetrisAI(-0.510066, 0.760666, -0.35663, -0.184483)
TetrisAI(): TetrisAI(-0.510066f, 0.760666f, -0.35663f, -0.184483f)
{}
TetrisAI(float aHeight, float fullLines, float holes, float bumpiness):
@ -178,9 +178,9 @@ public:
if(findWorstMove)
{
//init rating for worst
if(bestRating->score == -DBL_MAX)
if(bestRating->score == -FLT_MAX)
{
bestRating->score = DBL_MAX;
bestRating->score = FLT_MAX;
}
// update if we found a worse one

View File

@ -155,7 +155,7 @@ uint16_t mode_2DTetrisAI()
if (tetrisai_data->intelligence != SEGMENT.custom1)
{
tetrisai_data->intelligence = SEGMENT.custom1;
float dui = 0.2 - (0.2 * (tetrisai_data->intelligence / 255.0));
float dui = 0.2f - (0.2f * (tetrisai_data->intelligence / 255.0f));
tetrisai_data->tetris.ai.aHeight = -0.510066f + dui;
tetrisai_data->tetris.ai.fullLines = 0.760666f - dui;