Le support aux utilisateurs et les demandes de création de comptes externes doivent être faites depuis les issues du projet GitLab HEFR (https://gitlab.forge.hefr.ch/forge-hefr/gitlab-hefr)

Commit 484a0876 authored by Nicolas Maier's avatar Nicolas Maier
Browse files

Meilleur random

parent 0c6e0c3c
Pipeline #7257 passed with stage
in 40 seconds
......@@ -62,7 +62,7 @@
#define MIN_OFFSET_ANGLE_MODIFIER 2
#define SPECIAL_LOADING_MAX 12000000
#define MAX_SPECIAL 3
#define MAX_PSEUDORAND 10
#define MAX_PSEUDORAND 1000
struct game_info {
bool isJ1;
......@@ -314,8 +314,7 @@ static void game_thread(void* param)
>= DISPLAY_GAME_AREA_SIZE/3) {
next_state.ball_dir.y = 0;
float angle = 1.0*(elapsed_time_2_us % MAX_PSEUDORAND)
/ MAX_PSEUDORAND;
float angle = (1.0*rand()) / RAND_MAX;
angle *= (PI - 2*MIN_ANGLE);
angle += MIN_ANGLE;
......@@ -450,6 +449,8 @@ static void game_buttons_handler(enum buttons_set btn, void* param) {
}
void game_init(bool initIsJ1, msgqid_t msgq_game, msgqid_t msgq_game_pty) {
srand(timer_get_counter(TIMER_WAIT_END));
leds_init();
buttons_on_event(game_buttons_handler, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment