/************************************************************************* * Function name: sendHitFeedback * The Input: coordinates of the guess and the result of attack * The output: - * The Function operation: gets feedback on the guess and saves the results * for future guesses *************************************************************************/ void ComputerPlayer::sendHitFeedback(Coordinates guess, HitStatus& status) { switch (status) { case KILL: // the ship is destroyed. Forget all future guesses while (!futureHits.empty()) { futureHits.pop(); } yellOnMyHit(); // say something break; case HIT: // continue destroying the ship pushNeighbours(guess); yellOnMyHit(); // say something break; case MISS: // fail. break; default: break; } }
static boolean expandLongNode(Node * node, boolean force_jumps) { boolean hit = true; boolean modified = false; Node *oppositeNode; Coordinate distance = 0; markInterestingNodes(node); while (hit) { correctGraphLocally(node); findOppositeNode(node, &oppositeNode, &distance); hit = pushNeighbours(node, oppositeNode, distance, force_jumps); modified = modified || hit; } unmarkInterestingNodes(); return modified; }