mirror of
https://github.com/3b1b/manim.git
synced 2025-07-29 21:12:35 +08:00
After running 2to3
This commit is contained in:
@ -372,8 +372,8 @@ class TowersOfHanoiScene(Scene):
|
||||
self.move_disk_to_peg(disk_index, next_peg_index, **kwargs)
|
||||
|
||||
def move_subtower_to_peg(self, num_disks, next_peg_index, **kwargs):
|
||||
disk_indices = range(num_disks)
|
||||
peg_indices = map(self.disk_index_to_peg_index, disk_indices)
|
||||
disk_indices = list(range(num_disks))
|
||||
peg_indices = list(map(self.disk_index_to_peg_index, disk_indices))
|
||||
if len(set(peg_indices)) != 1:
|
||||
warnings.warn("These disks don't make up a tower right now")
|
||||
self.move_disks_to_peg(disk_indices, next_peg_index, **kwargs)
|
||||
@ -470,7 +470,7 @@ def get_binary_tex_mobs(num_list):
|
||||
nudge = zero_width + SMALL_BUFF
|
||||
for num in num_list:
|
||||
bin_string = bin(num)[2:]#Strip off the "0b" prefix
|
||||
bits = VGroup(*map(TexMobject, bin_string))
|
||||
bits = VGroup(*list(map(TexMobject, bin_string)))
|
||||
for n, bit in enumerate(bits):
|
||||
bit.shift(n*nudge*RIGHT)
|
||||
bits.move_to(ORIGIN, RIGHT)
|
||||
@ -782,7 +782,7 @@ class KeithShowingBinary(Scene):
|
||||
randy.bubble.set_fill(BLACK, opacity = 1)
|
||||
randy.bubble.write("Hold on...how does \\\\ binary work again?")
|
||||
|
||||
binary_tex_mobs = get_binary_tex_mobs(range(16))
|
||||
binary_tex_mobs = get_binary_tex_mobs(list(range(16)))
|
||||
binary_tex_mobs.shift(keith.get_corner(UP+LEFT))
|
||||
binary_tex_mobs.shift(0.5*(UP+RIGHT))
|
||||
bits_list = binary_tex_mobs.split()
|
||||
@ -934,7 +934,7 @@ class RhythmOfDecimalCounting(CountingScene):
|
||||
self.wait()
|
||||
self.play(
|
||||
ten_group.restore,
|
||||
*map(FadeOut, [brace, two_digits])
|
||||
*list(map(FadeOut, [brace, two_digits]))
|
||||
)
|
||||
|
||||
for x in range(89):
|
||||
@ -986,7 +986,7 @@ class DecimalCountingAtHundredsScale(CountingScene):
|
||||
).update(1)
|
||||
|
||||
for x in range(10):
|
||||
this_range = range(8) if x == 0 else range(9)
|
||||
this_range = list(range(8)) if x == 0 else list(range(9))
|
||||
for y in this_range:
|
||||
self.increment(run_time_per_anim = 0.25)
|
||||
self.increment(run_time_per_anim = 1)
|
||||
@ -1095,7 +1095,7 @@ class IntroduceBinaryCounting(BinaryCountingScene):
|
||||
Transform(twos_place, fours_place),
|
||||
)
|
||||
self.play(Blink(randy))
|
||||
self.play(*map(FadeOut, [bubble, curr_content]))
|
||||
self.play(*list(map(FadeOut, [bubble, curr_content])))
|
||||
|
||||
#Up to 1000
|
||||
for x in range(4):
|
||||
@ -1105,7 +1105,7 @@ class IntroduceBinaryCounting(BinaryCountingScene):
|
||||
self.play(
|
||||
randy.change_mode, "happy",
|
||||
randy.look_at, self.number_mob,
|
||||
*map(MoveToTarget, [brace, twos_place])
|
||||
*list(map(MoveToTarget, [brace, twos_place]))
|
||||
)
|
||||
for x in range(8):
|
||||
self.increment(total_run_time = 1)
|
||||
@ -1176,7 +1176,7 @@ class BinaryCountingAtEveryScale(Scene):
|
||||
bit_mob.set_color(YELLOW)
|
||||
bit_mob[0].set_color(MAROON_B)
|
||||
self.play(get_run_through(bit_mobs[1:2**(self.num_bits-1)]))
|
||||
self.play(*map(FadeIn, [upper_brace, roll_over]))
|
||||
self.play(*list(map(FadeIn, [upper_brace, roll_over])))
|
||||
self.play(Transform(
|
||||
VGroup(*reversed(list(curr_bits))),
|
||||
VGroup(*reversed(list(bit_mobs[2**(self.num_bits-1)]))),
|
||||
@ -1344,7 +1344,7 @@ class IntroduceSolveByCounting(TowersOfHanoiScene):
|
||||
disk[1].set_fill, BLACK,
|
||||
eights_bit.restore,
|
||||
)
|
||||
self.play(*map(FadeOut, [brace, words]))
|
||||
self.play(*list(map(FadeOut, [brace, words])))
|
||||
for disk_index in get_ruler_sequence(2):
|
||||
self.play(self.get_increment_animation())
|
||||
self.move_disk(disk_index, stay_on_peg = False)
|
||||
@ -1522,7 +1522,7 @@ class RecursiveSolution(TowersOfHanoiScene):
|
||||
)
|
||||
self.wait()
|
||||
self.blink()
|
||||
self.play(*map(FadeOut, [bubble, bubble.content]))
|
||||
self.play(*list(map(FadeOut, [bubble, bubble.content])))
|
||||
big_disk.remove(self.eyes)
|
||||
self.move_subtower_to_peg(3, 2, run_time = 2, added_anims = [
|
||||
self.eyes.look_at_anim(self.pegs[2].get_top()),
|
||||
@ -1553,7 +1553,7 @@ class RecursiveSolution(TowersOfHanoiScene):
|
||||
self.wait()
|
||||
self.play(
|
||||
GrowFromCenter(sub_sub_steps_brace),
|
||||
*map(FadeOut, [arc, q_mark])
|
||||
*list(map(FadeOut, [arc, q_mark]))
|
||||
)
|
||||
|
||||
#Disk 2 frustration
|
||||
@ -2043,9 +2043,9 @@ class RecursiveSolutionToConstrained(RecursiveSolution):
|
||||
for steps in subdivisions
|
||||
]
|
||||
sub_steps_brace, sub_sub_steps_brace = braces[:2]
|
||||
steps = VGroup(title, *it.chain(*zip(
|
||||
steps = VGroup(title, *it.chain(*list(zip(
|
||||
braces, subdivisions
|
||||
)))
|
||||
))))
|
||||
steps.arrange_submobjects(DOWN)
|
||||
steps.to_edge(UP)
|
||||
|
||||
@ -2405,13 +2405,13 @@ class TernaryCountingSelfSimilarPattern(Scene):
|
||||
title = TextMobject("Count to " + "2"*self.num_trits)
|
||||
for i, color in enumerate(colors):
|
||||
title[-i-1].set_color(color)
|
||||
steps = VGroup(*map(TextMobject, [
|
||||
steps = VGroup(*list(map(TextMobject, [
|
||||
"Count to %s,"%("2"*(self.num_trits-1)),
|
||||
"Roll over,",
|
||||
"Count to %s,"%("2"*(self.num_trits-1)),
|
||||
"Roll over,",
|
||||
"Count to %s,"%("2"*(self.num_trits-1)),
|
||||
]))
|
||||
])))
|
||||
steps.arrange_submobjects(RIGHT)
|
||||
for step in steps[::2]:
|
||||
for i, color in enumerate(colors[:-1]):
|
||||
@ -2572,7 +2572,7 @@ class DescribeSolutionByCountingToConstrained(SolveConstrainedWithTernaryCountin
|
||||
)
|
||||
self.move_next_disk(stay_on_peg = True)
|
||||
self.wait()
|
||||
self.play(*map(FadeOut, [brace, word]))
|
||||
self.play(*list(map(FadeOut, [brace, word])))
|
||||
|
||||
#Count up to 22
|
||||
for x in range(5):
|
||||
@ -2595,7 +2595,7 @@ class DescribeSolutionByCountingToConstrained(SolveConstrainedWithTernaryCountin
|
||||
self.wait()
|
||||
self.move_next_disk(stay_on_peg = True)
|
||||
self.wait()
|
||||
self.play(*map(FadeOut, [braces[2], words[2]]))
|
||||
self.play(*list(map(FadeOut, [braces[2], words[2]])))
|
||||
|
||||
for x in range(20):
|
||||
self.increment()
|
||||
@ -2743,7 +2743,7 @@ class RepeatingConfiguraiton(Scene):
|
||||
arrows = VGroup(*[Arrow(LEFT, RIGHT) for x in range(9)])
|
||||
arrows.add(VGroup())
|
||||
arrows.scale(0.5)
|
||||
group = VGroup(*it.chain(*zip(dots, arrows)))
|
||||
group = VGroup(*it.chain(*list(zip(dots, arrows))))
|
||||
group.arrange_submobjects()
|
||||
title = TextMobject("Same state twice")
|
||||
title.shift(3*UP)
|
||||
@ -2780,7 +2780,7 @@ class ShowSomeGraph(Scene):
|
||||
title.scale(2)
|
||||
title.to_edge(UP)
|
||||
|
||||
nodes = VGroup(*map(Dot, [
|
||||
nodes = VGroup(*list(map(Dot, [
|
||||
2*LEFT,
|
||||
UP,
|
||||
DOWN,
|
||||
@ -2788,7 +2788,7 @@ class ShowSomeGraph(Scene):
|
||||
2*RIGHT+2*UP,
|
||||
2*RIGHT+2*DOWN,
|
||||
4*RIGHT+2*UP,
|
||||
]))
|
||||
])))
|
||||
edge_pairs = [
|
||||
(0, 1),
|
||||
(0, 2),
|
||||
@ -2904,7 +2904,7 @@ class SierpinskiGraphScene(Scene):
|
||||
min_distance = self.distance_between_nodes(0, 1)
|
||||
min_distance *= 1.1 ##Just a little buff to be sure
|
||||
node_radius = self.nodes[0].get_width()/2
|
||||
for i, j in it.combinations(range(3**self.num_disks), 2):
|
||||
for i, j in it.combinations(list(range(3**self.num_disks)), 2):
|
||||
center1 = self.nodes[i].get_center()
|
||||
center2 = self.nodes[j].get_center()
|
||||
vect = center1-center2
|
||||
@ -3002,7 +3002,7 @@ class IntroduceGraphStructure(SierpinskiGraphScene):
|
||||
arc.set_color(YELLOW)
|
||||
node.arc = arc
|
||||
|
||||
self.play(*map(MoveToTarget, nodes))
|
||||
self.play(*list(map(MoveToTarget, nodes)))
|
||||
edge = Line(
|
||||
nodes[0].get_right(), nodes[1].get_left(),
|
||||
color = YELLOW,
|
||||
@ -3070,7 +3070,7 @@ class DescribeTriforcePattern(SierpinskiGraphScene):
|
||||
node.target.set_height(6)
|
||||
node.target.center().next_to(ORIGIN, vect)
|
||||
|
||||
self.play(*map(MoveToTarget, nodes))
|
||||
self.play(*list(map(MoveToTarget, nodes)))
|
||||
self.wait()
|
||||
self.play(*[node.restore for node in nodes])
|
||||
bold_edges = [
|
||||
@ -3079,14 +3079,14 @@ class DescribeTriforcePattern(SierpinskiGraphScene):
|
||||
]
|
||||
self.play(ShowCreation(bold_edges[0]))
|
||||
self.wait()
|
||||
self.play(*map(ShowCreation, bold_edges[1:]))
|
||||
self.play(*list(map(ShowCreation, bold_edges[1:])))
|
||||
self.wait()
|
||||
|
||||
power_of_three = 3**(self.scale-1)
|
||||
index_sets = [
|
||||
range(0, power_of_three),
|
||||
range(power_of_three, 2*power_of_three),
|
||||
range(2*power_of_three, 3*power_of_three),
|
||||
list(range(0, power_of_three)),
|
||||
list(range(power_of_three, 2*power_of_three)),
|
||||
list(range(2*power_of_three, 3*power_of_three)),
|
||||
]
|
||||
if self.first_connect_0_and_2_islands:
|
||||
index_sets = [index_sets[0], index_sets[2], index_sets[1]]
|
||||
@ -3100,7 +3100,7 @@ class DescribeTriforcePattern(SierpinskiGraphScene):
|
||||
run_time = 1,
|
||||
rate_func = wiggle
|
||||
)
|
||||
self.play(*map(wiggle_island, islands[:2]))
|
||||
self.play(*list(map(wiggle_island, islands[:2])))
|
||||
self.wait()
|
||||
self.play(wiggle_island(islands[2]))
|
||||
self.wait()
|
||||
@ -3205,12 +3205,12 @@ class PatreonThanks(Scene):
|
||||
special_thanks.set_color(YELLOW)
|
||||
special_thanks.shift(3*UP)
|
||||
|
||||
left_patrons = VGroup(*map(TextMobject,
|
||||
left_patrons = VGroup(*list(map(TextMobject,
|
||||
self.specific_patrons[:n_patrons/2]
|
||||
))
|
||||
right_patrons = VGroup(*map(TextMobject,
|
||||
)))
|
||||
right_patrons = VGroup(*list(map(TextMobject,
|
||||
self.specific_patrons[n_patrons/2:]
|
||||
))
|
||||
)))
|
||||
for patrons, vect in (left_patrons, LEFT), (right_patrons, RIGHT):
|
||||
patrons.arrange_submobjects(DOWN, aligned_edge = LEFT)
|
||||
patrons.next_to(special_thanks, DOWN)
|
||||
|
Reference in New Issue
Block a user