Struct advent_solutions::advent2017::day22::Carrier
[−]
[src]
pub struct Carrier { /* fields omitted */ }To prevent overloading the nodes (which would render them useless to the virus) or detection by system administrators, exactly one virus carrier moves through the network, infecting or cleaning nodes as it moves. The virus carrier is always located on a single node in the network (the current node) and keeps track of the direction it is facing.
The virus carrier begins in the middle of the map facing up.
Methods
impl Carrier[src]
pub fn part2_with_bursts(&mut self, memory: &mut Memory)[src]
As you go to remove the virus from the infected nodes, it evolves to resist your attempt.
Now, before it infects a clean node, it will weaken it to disable your defenses. If it encounters an infected node, it will instead flag the node to be cleaned in the future. So:
- Clean nodes become weakened.
- Weakened nodes become infected.
- Infected nodes become flagged.
- Flagged nodes become clean.
Every node is always in exactly one of the above states.
The virus carrier still functions in a similar way, but now uses the following logic during its bursts of action:
- Decide which way to turn based on the current node:
- If it is clean, it turns left.
- If it is weakened, it does not turn, and will continue moving in the same direction.
- If it is infected, it turns right.
- If it is flagged, it reverses direction, and will go back the way it came.
- Modify the state of the current node, as described above.
- The virus carrier moves forward one node in the direction it is facing.
Trait Implementations
impl Clone for Carrier[src]
fn clone(&self) -> Carrier[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq for Carrier[src]
fn eq(&self, __arg_0: &Carrier) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Carrier) -> bool[src]
This method tests for !=.
impl Eq for Carrier[src]
impl Debug for Carrier[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more