cooperationStatusString static method

String cooperationStatusString(
  1. NodeReputation node
)

Implementation

static String cooperationStatusString(NodeReputation node) {
  final limit = node.hasHistory ? node.pl : node.sl;
  final rep = node.reputation;
  final coop = node.canCooperate();
  final basicCheck = (node.battery < 6 || node.storage <= 3);

  if (basicCheck) {
    return "❌ Cannot cooperate: battery or storage too low.";
  } else if (coop) {
    return "✅ Allowed to cooperate: reputation (${rep.toStringAsFixed(2)}) ≥ threshold (${limit.toStringAsFixed(2)}).";
  } else {
    return "❌ Denied cooperation: reputation (${rep.toStringAsFixed(2)}) < threshold (${limit.toStringAsFixed(2)}).";
  }
}