π The rabbit problem implemented in Python language.
To run the rabbit program, execute the command below in the root directory of the project.
python main.py
more coming soon...
In order to create your own algorithm, attempting to find the rabbit problem, the following steps are necessary:
- Create a new file in
algos/__name__.py
. - Extend the Rabbit class:
from rabbit import Rabbit
class UnnamedRabbit(Rabbit):
"""..."""
def __init__(self, holes: int):
super().__init__("Unnamed Rabbit", holes)
# The main function being run on every cycle/rabbit move.
def lifecycle(self):
# Check whether the rabbit is in the given hole.
self.checkHole(0)
- Import and initialize an instance of your new algorithm in
main.py
located in the root directory.
from algos.__name__ import UnnamedRabbit
...
unnamedRabbit = UnnamedRabbit(default_holes)
- Have fun writing your algorithm!
rabbit-problem-python
β main.py - The entry file, run it to see the result.
β rabbit.py - The rabbit class powering the various custom algorighms.
β setup.py - The setup file, run it to install the package. *NOT WORKING YET!*
β utils.py - The utils file, contains various functions used by the other files.
β
ββββalgos
β linear.py - The linear algorithm attempting to find rabbit.
β random.py - The random algorithm attempting to find rabbit.