-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from Stegallo/2015
2015
- Loading branch information
Showing
8 changed files
with
70 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
def bitand(x: int, y: int) -> int: | ||
return x & y | ||
|
||
|
||
def bitor(x: int, y: int) -> int: | ||
return x | y | ||
|
||
|
||
def lshift(x: int, y: int) -> int: | ||
return x << y | ||
|
||
|
||
def rshift(x: int, y: int) -> int: | ||
return x >> y | ||
|
||
|
||
def bitnot(x: int) -> int: | ||
return x ^ 65535 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ flake8 | |
isort | ||
pre-commit | ||
pytest | ||
pytest-cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from common.utilities import bitand, bitor, lshift, rshift, bitnot | ||
|
||
|
||
def test_bit_ops(): | ||
assert bitand(1, 2) == 0 | ||
assert bitor(1, 2) == 3 | ||
assert lshift(1, 2) == 4 | ||
assert rshift(1, 2) == 0 | ||
assert bitnot(1) == 65534 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from common.aoc import AoCDay | ||
|
||
|
||
class Day(AoCDay): | ||
def __init__(self, test=0): | ||
super().__init__(__name__, test) | ||
|
||
def _preprocess_input(self): | ||
# self.__input_data = [[int(i) for i in chunk] for chunk in self._input_data] | ||
print(f"{self._input_data=}") | ||
self.__input_data = self._input_data[0] | ||
|
||
def _calculate_1(self): | ||
x = self.__input_data | ||
print(f"{x=}") | ||
return 0 | ||
|
||
def _calculate_2(self): | ||
x = self.__input_data | ||
print(f"{x=}") | ||
return 0 |