adventofcode.year_2021.day_2021_02.readable
Module Contents
Classes
Abstraction for a submarine |
|
A special submarine that moves following commands, without an aim. |
|
A special submarine, the moves of which depend on its changing aim. |
Functions
|
|
|
Attributes
- adventofcode.year_2021.day_2021_02.readable.commands
- class adventofcode.year_2021.day_2021_02.readable.Submarine
Abstraction for a submarine
It’s only defined by its original position and how we compute the answer.
- answer(self)
Give the answer to the challenge (horizontal position x depth)
- Returns:
int: The answer
- class adventofcode.year_2021.day_2021_02.readable.SubmarineWithoutAim
Bases:
SubmarineA special submarine that moves following commands, without an aim.
- move(self, command, value)
Move the submarine according to the command type and its value
- Args:
command (str): The command given to the submarine, either ‘forward’ or ‘updown’ value (int): The number of space units to use for the command
- class adventofcode.year_2021.day_2021_02.readable.SubmarineWithAim
Bases:
SubmarineA special submarine, the moves of which depend on its changing aim.
- move(self, command, value)
Move the submarine according to the command type and its value, using the aim
- Args:
command (str): The command given to the submarine, either ‘forward’ or ‘updown’ value (int): The number of space units to use for the command
- adventofcode.year_2021.day_2021_02.readable.part1()
- adventofcode.year_2021.day_2021_02.readable.part2()