Esempio n. 1
0
 def test_find_all_seven_object_period_9_siteswaps_with_passes_selfs_and_heffs(
         self):
     partial_siteswap = ['?'] * 9
     output = complete_the_siteswap.filter_rotations(
         complete_the_siteswap.complete(partial_siteswap, [6, 7, 8], 7))
     # 10 according to juggling lab.
     self.assertEqual(len(output), 10)
Esempio n. 2
0
 def test_find_all_three_object_period_5_siteswaps_max_height_9(self):
     partial_siteswap = ['?'] * 5
     output = complete_the_siteswap.filter_rotations(
         complete_the_siteswap.complete(partial_siteswap, list(range(8)),
                                        3))
     # 89 according to juggling lab.
     self.assertEqual(len(output), 89)
Esempio n. 3
0
def do_not_throw_pass(raw_siteswap, index, permitted_throws):

    patterns_found = []
    siteswap = raw_siteswap.copy()
    siteswap = siteswap[index:] + siteswap[:index]  # rotate so pass at front
    number_of_objects = sum(siteswap) / len(siteswap)
    # print(siteswap)

    if siteswap[0] % 2 != 1:
        print("There's no pass there not to throw!")
        return None

    elif len([throw for throw in raw_siteswap if throw % 2 == 1]) <= 2:
        #All selfs, not an interesting pattern
        return []
    else:  # first throw is a pass and still have passes after removing it
        siteswap[(siteswap[0] - 2) % len(siteswap)] = 2
        siteswap[0] = '?'

    for time, throw in enumerate(siteswap):
        if throw != '?' and time % 2 == 0 and throw % 2 == 0:
            siteswap[time] = '?'

    permitted_self_throws = [
        throw for throw in permitted_throws if throw % 2 == 0
    ]  # This is to rule out adding in extra passes over the transition
    solutions = complete_the_siteswap.complete(siteswap, permitted_self_throws,
                                               number_of_objects)
    raw_siteswap = raw_siteswap[index:] + raw_siteswap[:index]
    if solutions == []:
        pass
    for pattern in complete_the_siteswap.filter_rotations(solutions):
        patterns_found.append(
            find_transitions(raw_siteswap, pattern, [2, 4, 6, 8]))
    return patterns_found
Esempio n. 4
0
 def test_find_all_three_object_period_5_siteswaps_max_height_9_no_0s_or_2s(
         self):
     partial_siteswap = ['?'] * 5
     output = complete_the_siteswap.filter_rotations(
         complete_the_siteswap.complete(partial_siteswap,
                                        [1, 3, 4, 5, 6, 7], 3))
     # 12 according to juggling lab.
     self.assertEqual(len(output), 12)
Esempio n. 5
0
def throw_extra_pass(raw_siteswap,
                     index,
                     permitted_throws,
                     extra_pass=None,
                     response_pass=None):
    if len(raw_siteswap) % 2 == 1:
        raw_siteswap *= 2
    siteswap = raw_siteswap.copy()
    siteswap = siteswap[
        index:] + siteswap[:index]  # rotate so extra pass is at front
    patterns_found = []
    # print(siteswap)

    number_of_objects = sum(siteswap) / len(siteswap)

    for time, throw in enumerate(siteswap):
        if time % 2 == 0 and throw % 2 == 0:
            siteswap[time] = '?'
    if extra_pass == None:
        extra_pass = len(raw_siteswap) // 2 + 2
    siteswap[0] = extra_pass
    # TODO: does this give weird results?
    if response_pass == None:
        response_pass = len(raw_siteswap) // 2 + 2
    siteswap[(extra_pass - 2) % len(siteswap)] = response_pass

    permitted_self_throws = [
        throw for throw in permitted_throws if throw % 2 == 0
    ]  # This is to rule out adding in extra passes over the transition
    solutions = complete_the_siteswap.complete(siteswap, permitted_self_throws,
                                               number_of_objects)
    raw_siteswap = raw_siteswap[index:] + raw_siteswap[:index]
    if solutions == []:
        pass
    for pattern in complete_the_siteswap.filter_rotations(solutions):
        patterns_found.append(
            find_transitions(raw_siteswap, pattern, [2, 4, 6, 8]))
    return patterns_found
Esempio n. 6
0
 def test_remove_duplicates_but_not_anagrams(self):
     input = [[8, 0, 1], [7, 2, 3], [9, 7, 5], [1, 8, 0], [7, 4, 1],
              [7, 1, 4]]
     output = complete_the_siteswap.filter_rotations(input)
     answer = [[8, 0, 1], [7, 2, 3], [9, 7, 5], [7, 4, 1], [7, 1, 4]]
     self.assertEqual(output, answer)
Esempio n. 7
0
 def test_remove_cycles_of_period_5(self):
     siteswap = [9, 7, 5, 3, 1]
     input = [siteswap[i:] + siteswap[:i] for i in range(0, 5)]
     output = complete_the_siteswap.filter_rotations(input)
     answer = [siteswap]
     self.assertEqual(output, answer)
Esempio n. 8
0
 def test_remove_cycles_of_period_3(self):
     input = [[4, 2, 3], [2, 3, 4], [3, 4, 2]]
     output = complete_the_siteswap.filter_rotations(input)
     answer = [[4, 2, 3]]
     self.assertEqual(output, answer)
Esempio n. 9
0
 def test_find_all_three_object_period_3_siteswaps_max_height_9(self):
     partial_siteswap = ['?'] * 3
     output = complete_the_siteswap.filter_rotations(
         complete_the_siteswap.complete(partial_siteswap, list(range(10)),
                                        3))
     self.assertEqual(len(output), 13)