Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
languagejavascript
linenumberstrue
function generatorRequiredgeneratorsRequired(player) {
  if (player == null) player == me;
  if (player<0 || player>maxPlayers) return 0;
  var num_res  = enumStruct(player,RESOURCE_EXTRACTOR).length;
  var num_gens = enumStruct(player,POWER_GEN).length;
  var gens_needed = Math.ceil(num_res/4);
  return Math.max(0,gens_needed-num_gens);
}

...