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
from enum import Enum | |
from fractions import Fraction | |
import numpy as np | |
def override_str(self): | |
if self._denominator == 1: | |
return str(self._numerator) | |
else: |
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
#!/usr/bin/python | |
# Arithmetic game where you have to multiply numbers in your head | |
# Choose up to n digits | |
# Ideas for game | |
# More digits as you progress, game gets harder incrementally | |
# Encode numbers a and b as 2x10 2,13,4x10 or 7-8x10 | |
# - Recursively parse 2-9,45-29x2 | |
# Hints after periods of inactivity, for example if asked to multiply 68x92, then a hint could be 90x8=720 |