<commit_before>#include "simulation.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <math.h>

#include "config.h"
#include "network.h"

static SimPlanet* planet;
static SimPlayer* player;
static int currentPlayer;
static char deathMessage[128];
static double killflash;
static double pmin, pmax;

static void initPlanets(void)
{
   int i, j;

   for(i = 0; i < conf.numPlanets; i++)
   {
      int nok;
      do
      {
         planet[i].radius = 20.0 + (double)rand() / RAND_MAX * 20.0;
         planet[i].mass = planet[i].radius * planet[i].radius * planet[i].radius / 10.0;
         planet[i].position.x = planet[i].radius + (double)rand() / RAND_MAX * (conf.battlefieldW - planet[i].radius * 2);
         planet[i].position.y = planet[i].radius + (double)rand() / RAND_MAX * (conf.battlefieldH - planet[i].radius * 2);
         nok = 0;
         for(j = 0; j < i; ++j)
         {
            if(distance(planet[i].position, planet[j].position) <= (planet[i].radius + planet[j].radius))
            {
               nok = 1;
            }
         }
      } while (nok);
   }

   {
      Vec2d p;
      double sum = 0;
      int num = 0;

      for(p.x = -20 * conf.battlefieldW / 120; p.x < 140 * conf.battlefieldW / 120; p.x += conf.battlefieldW / 120)
      {
         for(p.y = -20 * conf.battlefieldH / 80; p.y < 100 * conf.battlefieldH / 80; p.y += conf.battlefieldH / 80)
         {
            double pot = getGPotential(p);
            if (pot > 0.1)
            {
               sum += pot;
               num++;
            }
         }
      }

      pmax = 1.3 * sum / num;
      pmin = 1.0 * sum / num;

      printf("pmin: %.2lf pmax: %.2lf\n", pmin, pmax);
   }
}

static void initPlayer(int p, int clear)
{
   int i, j, k, nok, tries;

   if(clear)
   {
      player[p].angle = 0.0;
      player[p].energy = 25.0;
      player[p].velocity = 10.0;<commit_msg>diff pmin / pmax is now 40. this allows to reach everybody with v=9 (connectedness assumed).<commit_after>#include "simulation.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <math.h>

#include "config.h"
#include "network.h"

static SimPlanet* planet;
static SimPlayer* player;
static int currentPlayer;
static char deathMessage[128];
static double killflash;
static double pmin, pmax;

static void initPlanets(void)
{
   int i, j;

   for(i = 0; i < conf.numPlanets; i++)
   {
      int nok;
      do
      {
         planet[i].radius = 20.0 + (double)rand() / RAND_MAX * 20.0;
         planet[i].mass = planet[i].radius * planet[i].radius * planet[i].radius / 10.0;
         planet[i].position.x = planet[i].radius + (double)rand() / RAND_MAX * (conf.battlefieldW - planet[i].radius * 2);
         planet[i].position.y = planet[i].radius + (double)rand() / RAND_MAX * (conf.battlefieldH - planet[i].radius * 2);
         nok = 0;
         for(j = 0; j < i; ++j)
         {
            if(distance(planet[i].position, planet[j].position) <= (planet[i].radius + planet[j].radius))
            {
               nok = 1;
            }
         }
      } while (nok);
   }

   {
      Vec2d p;
      double sum = 0;
      int num = 0;

      for(p.x = -20 * conf.battlefieldW / 120; p.x < 140 * conf.battlefieldW / 120; p.x += conf.battlefieldW / 120)
      {
         for(p.y = -20 * conf.battlefieldH / 80; p.y < 100 * conf.battlefieldH / 80; p.y += conf.battlefieldH / 80)
         {
            double pot = getGPotential(p);
            if (pot > 0.1)
            {
               sum += pot;
               num++;
            }
         }
      }

      pmax = 1.1 * sum / num + 20;
      pmin = 1.1 * sum / num - 20;

      printf("pmin: %.2lf pmax: %.2lf\n", pmin, pmax);
   }
}

static void initPlayer(int p, int clear)
{
   int i, j, k, nok, tries;

   if(clear)
   {
      player[p].angle = 0.0;
      player[p].energy = 25.0;
      player[p].velocity = 10.0;
{'fraction_non_alphanumeric': 0.15873823454591707, 'fraction_numerical': 0.033324853726787076, 'mean_word_length': 1.8826979472140764, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3982262', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1434, 'n_words': 335}