#include "pico/stdlib.h"
#include "i2c_annexe.h"
#include "Score.h"

#define SCORE_INITIAL 0

uint32_t Score_nb_points;
uint32_t Score_plante_zone_normale=0;
uint32_t Score_plante_jardiniere=0;
uint32_t Score_panneau=0;
uint32_t Score_pieds_dans_plat=0;

void Score_recalcule(){
    Score_nb_points = SCORE_INITIAL;
    Score_nb_points += Score_plante_zone_normale;
    Score_nb_points += Score_plante_jardiniere;
    Score_nb_points += Score_panneau;
    Score_nb_points += Score_pieds_dans_plat;

}

void Score_actualise(){
    Score_recalcule();
    i2c_annexe_envoie_score(Score_nb_points);
}

/// @brief 10 points si le robot finit dans une autre zone que la sienne
void Score_set_pieds_dans_plat(){
    Score_pieds_dans_plat = 10;
    Score_actualise();
}

/// @brief Ajout 5 points au score par panneaux
/// @param nb_panneau 
void Score_ajout_panneau(uint32_t nb_panneau){
    Score_panneau += (nb_panneau*5);
    Score_actualise();
}