canCooperate method
Implementation
bool canCooperate() {
final limit = hasHistory ? pl : sl;
if (kDebugMode) {
print("🧠 Cooperation Evaluation:");
print("History available: $hasHistory → Threshold = $limit");
print("Battery: $battery%, Storage: $storage%");
}
// If battery or storage are critically low, cooperation is denied
if (battery < 6 || storage <= 3) {
canCooperatee = false;
if (kDebugMode) {
print("❌ Cooperation denied: battery or storage too low.");
}
} else {
canCooperatee = reputation >= limit;
if (canCooperatee) {
if (kDebugMode) {
print(
"✅ Cooperation allowed: reputation = $reputation ≥ threshold = $limit");
}
} else {
if (kDebugMode) {
print(
"❌ Cooperation denied: reputation = $reputation < threshold = $limit");
}
}
}
return canCooperatee;
}