tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

A player that respawns gets assigned a new colour among RGB at random #612

Open TheoPannetier opened 2 years ago

TheoPannetier commented 2 years ago

Depends:

Upon joining the game again, a player should be assigned a new (red, green or blue) color at random, to get a chance to avoid being stuck in the same position as before dying.

Test

  // (612) A player that revives gets a new colour at random
  player p;
  color c;
  int n_red = 0;
  int n_green = 0;
  int n_blue = 0;
  const color r = create_red_color();
  const color g = create_green_color();
  const color b = create_blue_color();

  for (int i = 0; i < 100; ++i)
    {
      p.die();
      p.revive();
      c = p.get_color();
      if (c == r) { ++n_red; }
      else if (c == g) { ++n_green; }
      else if (c == b) { ++n_blue; }
      else { throw("A player should not revive with any other color than r, g, b"); }
  }
TheoPannetier commented 1 year ago

Removed from the game design for now; respawning with a new colour among RGB is troublesome as it can lead to all players having the same colour, blocking the game. Or the player could get a colour that is not strong against anything, and thus bound to be eaten and lose again.