示例#1
0
    [
        Path(Direction.UP, Status.BLOCKED),
        Path(Direction.RIGHT, Status.OPEN),
        Path(Direction.LEFT, Status.BLOCKED),
        Path(Direction.DOWN, Status.BLOCKED)
    ],
    [
        Path(Direction.UP, Status.BLOCKED),
        Path(Direction.RIGHT, Status.BLOCKED),
        Path(Direction.LEFT, Status.BLOCKED),
        Path(Direction.DOWN, Status.OPEN)
    ],
    [
        Path(Direction.UP, Status.BLOCKED),
        Path(Direction.RIGHT, Status.BLOCKED),
        Path(Direction.LEFT, Status.OPEN),
        Path(Direction.DOWN, Status.BLOCKED)
    ],
]

if __name__ == "__main__":

    res = ""

    for fork in path:
        selected = find_open_path(fork)
        res += str(selected)
        print("you went {}".format(selected.direction.name))

    print("Result : {}".format(get_hash(str(res))))
示例#2
0
import random

from adventures.pythonbeard.chapters.that_was_weird.memory_module import get_name
from adventures.pythonbeard.common.subconscious import Subconscious
from utils.level_key import get_hash

known_names = [
    "Pythonbeard", "Mommy", "Daddy", "Bob", "Mr. Donald", "Fartface", "No"
]

if __name__ == "__main__":
    pb_subconscious = Subconscious(known_names)

    user_res = get_name(pb_subconscious, "Bo")

    print("Pythonbeards says: {}".format(user_res))
    print("Result : {}".format(get_hash(user_res)))
示例#3
0
import random

from adventures.pythonbeard.chapters.tight_spots.arithmetic_module import compare_widths
from utils.level_key import get_hash

ships_width = 20

path_widths = [10, 30, 23, 21, 20, 15, 24]

if __name__ == "__main__":

    user_results = map(
        lambda paths_width: compare_widths(ships_width, paths_width),
        path_widths)

    for user, width in zip(user_results, path_widths):
        if user ^ (ships_width < width):
            print("You crashed at: {}".format(width))
        else:
            if not user:
                print("You dodged path: {}".format(width))

    print("Result : {}".format(get_hash(str(list(user_results)))))
示例#4
0
    StrengthPoint(Point(0, 0), 1),
    StrengthPoint(Point(1, 0), 2),
    StrengthPoint(Point(2, 0), 12),
    StrengthPoint(Point(3, 0), 100),
    StrengthPoint(Point(4, 0), 74),
    StrengthPoint(Point(5, 0), 23),
    StrengthPoint(Point(0, 1), 37),
    StrengthPoint(Point(0, 2), 8),
    StrengthPoint(Point(0, 3), 9),
    StrengthPoint(Point(0, 4), 79),
    StrengthPoint(Point(0, 5), 7),
    StrengthPoint(Point(0, 0), 34),
    StrengthPoint(Point(1, 1), 6),
    StrengthPoint(Point(2, 2), 20),
    StrengthPoint(Point(3, 3), 4),
    StrengthPoint(Point(2, 3), 12),
    StrengthPoint(Point(1, 3), 16),
    StrengthPoint(Point(1, 2), 12),
    StrengthPoint(Point(2, 1), 10),
    StrengthPoint(Point(3, 4), 19)
]

if __name__ == "__main__":

    sorted_p = find_weak_spots(points)

    print("The weakspots are :")
    for p in sorted_p:
        print("\t{}".format(p))
    print("Result : {}".format(get_hash(str(sorted_p))))
示例#5
0
from adventures.pythonbeard.chapters.parking.searching_module import search_parking
from adventures.pythonbeard.common.ship import Ship
from utils.level_key import get_hash

if __name__ == "__main__":
    parking_spots = range(10, 20, 2)
    ship = Ship(5, 15)

    match = search_parking(ship, parking_spots)

    print("Found at : {}".format(match))
    print("Result : {}".format(get_hash(str(match))))
示例#6
0
    PathBuilder(False, True, True),
    PathBuilder(False, False, False),
    PathBuilder(True, False, False),
    PathBuilder(False, True, True),
    PathBuilder(False, False, True),
    PathBuilder(False, True, True),
    PathBuilder(False, False, False),
    PathBuilder(False, False, True),
    PathBuilder(False, False, False),
]


def print_path(path: Path):
    if path == None:
        return

    print(path)
    print_path(path.left)
    print_path(path.right)


if __name__ == "__main__":
    user_res = ""

    cave = Cave(layout)

    directions = get_directions(cave)
    print("You're directions: {}".format(directions))

    print("Result : {}".format(get_hash(str(directions))))
示例#7
0
import random

from adventures.pythonbeard.chapters.atlantis.numbering_module import roman_to_decimal
from utils.level_key import get_hash

numbers = ["XIV", "LXXIX", "CCXXV", "DCCCXLV", "MMXXII"]

if __name__ == "__main__":
    user_sum = 0

    for num in numbers:
        print("{} - {}".format(num, roman_to_decimal(num)))
        user_sum += roman_to_decimal(num)

    print("Result : {}".format(get_hash(str(user_sum))))
示例#8
0
from adventures.pythonbeard.chapters.challenge_of_the_queen.problem_solving_module import queens
from utils.level_key import get_hash

if __name__ == "__main__":
    print("Pythonbeard Says : {}".format(queens()))

    print("Result : {}".format(get_hash(str(queens()))))
示例#9
0
import random

from adventures.pythonbeard.chapters.into_the_unknown.memory_module import translate_word
from adventures.pythonbeard.common.subconscious import Subconscious
from adventures.pythonbeard.common.languages import Language, atlasian
from utils.level_key import get_hash

atlasian_text = "Atlantis bing houmbala bam bang " \
                "shonta houmba sembe hercumba er " \
                "tang Atlantis shing Daraga "

if __name__ == "__main__":
    pb_subconscious = Subconscious(
        known_languages={Language.Atlasian: atlasian})

    normal = []

    for word in atlasian_text.split():
        normal.append(translate_word(pb_subconscious, word))

    translated = " ".join(normal)

    print("Translated: {}".format(translated))
    print("Result : {}".format(get_hash(translated)))
示例#10
0
def print(arg):
    sys.stdout.write(arg + "\r\n")
    sys.stdout.write("Result : {}\r\n".format(get_hash(arg)))