tag:crieit.net,2005:https://crieit.net/tags/%E3%81%AE%E3%82%93%E3%81%B3%E3%82%8A%E3%80%80%E6%95%B0%E5%AD%A6/feed
「のんびり 数学」の記事 - Crieit
Crieitでタグ「のんびり 数学」に投稿された最近の記事
2019-07-14T16:03:39+09:00
https://crieit.net/tags/%E3%81%AE%E3%82%93%E3%81%B3%E3%82%8A%E3%80%80%E6%95%B0%E5%AD%A6/feed
tag:crieit.net,2005:PublicArticle/15238
2019-07-14T13:50:39+09:00
2019-07-14T16:03:39+09:00
https://crieit.net/posts/Injection-Surjection-Bijection
Injection, Surjection, Bijection☆(^~^)
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 Crieiteブログで 数学用語を使いたいんで、説明したら使っていい、ということにする☆」</p>
<p>Git hub: <a target="_blank" rel="nofollow noopener" href="https://github.com/muzudho/jection">jection</a></p>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 ブルバキの真似か☆」</p>
<p><a href="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif?mw=700" alt="OKAZAKI_Yumemi_80x80x8_02_Syaberu.gif" /></a><br />
「 じゃあ インジェクション、サージェクション、バイジェクション で」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 Python3 の練習も兼ねたいんで、Python3 を使うことにする☆」</p>
<pre><code># There are 5 peoples. Pitcher have six boxes.
pitcher = [[2], [3], [5], [7], [11], [13]]
first = [[], [], [], [], [], []]
second = [[], [], [], [], [], []]
third = [[], [], [], [], [], []]
catcher = [[], [], [], [], [], []]
def show(person):
for box in person:
print("[", end="")
first = True
for ball in box:
if not first:
print(", ", end="")
else:
first = False
print("{:>2}".format(ball), end="")
print("]", end="")
print("")
# Result.
print("Pitcher: ", end="")
show(pitcher)
print("First : ", end="")
show(first)
print("Second : ", end="")
show(second)
print("Third : ", end="")
show(third)
print("Catcher: ", end="")
show(catcher)
</code></pre>
<pre><code>Pitcher: [ 2][ 3][ 5][ 7][11][13]
First : [][][][][][]
Second : [][][][][][]
Third : [][][][][][]
Catcher: [][][][][][]
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 9人集まらなかった野球部が 校庭に5人いる☆」</p>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 悲しい……☆」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 5人は 6個ずつ バケツを持っている☆」</p>
<p><a href="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif?mw=700" alt="OKAZAKI_Yumemi_80x80x8_02_Syaberu.gif" /></a><br />
「 グラブを持てばいいのに……」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 校庭には 6個のボールがあり、ピッチャーは バケツに1つずつボールを入れた☆」</p>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 何かの儀式か☆」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 ボールには 素数 2、3、5、7、11、13 の番号が 黒のマジックペン太 で キュッキュッっと 濃く書かれていたとする☆」</p>
<p><a href="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif?mw=700" alt="OKAZAKI_Yumemi_80x80x8_02_Syaberu.gif" /></a><br />
「 本当に野球部員なのかしら……?」</p>
<h1 id="Injection"><a href="#Injection">Injection</a></h1>
<pre><code>import random
def inject(person1, person2):
if len(person2) < len(person1):
print("Fail : Person1 {}, Person2 {}.".format(
len(person1), len(person2)))
return
destinations = list(range(len(person2)))
random.shuffle(destinations)
for i in range(0, len(person1)):
person2[destinations[i]] = person1[i]
# Go!
inject(pitcher, first)
inject(first, second)
inject(second, third)
inject(third, catcher)
</code></pre>
<pre><code>Pitcher: [ 2][ 3][ 5][ 7][11][13]
First : [13][ 3][ 5][ 7][ 2][11]
Second : [ 5][11][ 2][ 3][13][ 7]
Third : [13][ 5][11][ 2][ 3][ 7]
Catcher: [11][ 7][ 3][ 2][13][ 5]
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 漏れず被らず、バケツの中身を、移し替えるのが インジェクションだぜ☆<br />
関数はこんな感じでいいのか☆?」</p>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 何が嬉しくて こんなこと してるのか分からん☆」</p>
<pre><code># There are 5 peoples. Pitcher have six boxes.
pitcher = [[2], [3], [5], [7], [11], [13]]
first = [[], [], [], [], [], [], []]
second = [[], [], [], [], [], [], [], []]
third = [[], [], [], [], [], [], [], [], []]
catcher = [[], [], [], [], [], [], [], [], [], []]
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 ピッチャー以外の4人は、ピッチャーより多くのバケツを持っていることにしよう☆」</p>
<pre><code>Pitcher: [ 2][ 3][ 5][ 7][11][13]
First : [ 5][ 3][13][ 2][][ 7][11]
Second : [ 5][ 2][ 3][][][ 7][13][11]
Third : [ 5][][ 3][][ 2][13][][11][ 7]
Catcher: [ 2][ 5][ 3][][][13][][][ 7][11]
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 ちゃんと インジェクションできているな☆」</p>
<p><a href="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif?mw=700" alt="OKAZAKI_Yumemi_80x80x8_02_Syaberu.gif" /></a><br />
「 インジェクションじゃなくて、キャッチボールしましょうよ」</p>
<pre><code>def show(label, person):
print("{:<8}: ".format(label), end="")
for box in person:
print("[", end="")
first = True
for ball in box:
if not first:
print(", ", end="")
else:
first = False
print("{:>2}".format(ball), end="")
print("]", end="")
print("")
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 表示を ワンライナー(1行)で書けるように 改造☆」</p>
<pre><code>def inject(person1, person2):
# Delete an empty box.
person1 = [x for x in person1 if x]
if len(person2) < len(person1):
print("Fail : Person1 {}, Person2 {}.".format(
len(person1), len(person2)))
return
destinations = list(range(len(person2)))
random.shuffle(destinations)
for i in range(0, len(person1)):
person2[destinations[i]] = person1[i]
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 インジェクションを キャッチボールに対応☆」</p>
<pre><code># Go!
print("radio> Starting line up.")
show("Pitcher", pitcher)
show("First", first)
show("Second", second)
show("Third", third)
show("Catcher", catcher)
print("radio> The pitcher threw the ball towards first.")
inject(pitcher, first)
show("First", first)
print("radio> First returned the ball to the pitcher.")
inject(first, pitcher)
show("Pitcher", pitcher)
print("radio> The pitcher threw the ball towards second.")
inject(pitcher, second)
show("Second", second)
print("radio> Second returned the ball to the pitcher.")
inject(second, pitcher)
show("Pitcher", pitcher)
print("radio> The pitcher threw the ball towards third.")
inject(pitcher, third)
show("Third", third)
print("radio> Third returned the ball to the pitcher.")
inject(third, pitcher)
show("Pitcher", pitcher)
print("radio> The pitcher threw the ball towards catcher.")
inject(pitcher, catcher)
show("Catcher", catcher)
print("radio> Catcher returned the ball to the pitcher.")
inject(catcher, pitcher)
show("Pitcher", pitcher)
</code></pre>
<pre><code>radio> Starting line up.
Pitcher : [ 2][ 3][ 5][ 7][11][13]
First : [][][][][][][]
Second : [][][][][][][][]
Third : [][][][][][][][][]
Catcher : [][][][][][][][][][]
radio> The pitcher threw the ball towards first.
First : [][ 3][ 2][13][ 5][ 7][11]
radio> First returned the ball to the pitcher.
Pitcher : [13][ 2][ 7][ 5][11][ 3]
radio> The pitcher threw the ball towards second.
Second : [][11][ 3][13][][ 2][ 7][ 5]
radio> Second returned the ball to the pitcher.
Pitcher : [11][13][ 3][ 2][ 5][ 7]
radio> The pitcher threw the ball towards third.
Third : [][13][ 7][11][][][ 2][ 3][ 5]
radio> Third returned the ball to the pitcher.
Pitcher : [ 5][ 3][13][11][ 2][ 7]
radio> The pitcher threw the ball towards catcher.
Catcher : [13][ 3][][][ 2][ 7][][ 5][11][]
radio> Catcher returned the ball to the pitcher.
Pitcher : [13][ 2][ 3][11][ 5][ 7]
Info : Finished
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 おっ、野球っぽくなったな☆」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 本当か☆」</p>
<h1 id="Suejection"><a href="#Suejection">Suejection</a></h1>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 次はサージェクションだな☆」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 あっ、めんどくせっ☆!」</p>
<pre><code>class Person(object):
def __init__(self, name, boxes):
self._name = name
self._boxes = boxes
return
@property
def name(self):
return self._name
@property
def boxes(self):
return self._boxes
def clear_boxes(self):
for box in self._boxes:
box.clear()
def show(self):
print("{:<8}: ".format(self._name), end="")
for box in self._boxes:
print("[", end="")
first = True
for ball in box:
if not first:
print(", ", end="")
else:
first = False
print("{:>2}".format(ball), end="")
print("]", end="")
print("")
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 野球部員はクラスにして show は メソッドにするぜ☆」</p>
<pre><code># There are 5 peoples. Pitcher have six boxes.
pitcher = Person("Pitcher", [[2], [3], [5], [7], [11], [13]])
first = Person("First", [[], [], [], [], []])
second = Person("Second", [[], [], [], []])
third = Person("Third", [[], [], []])
catcher = Person("Catcher", [[], []])
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 名前も箱も持てだぜ☆」</p>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 箱が減ってしまって大丈夫か☆? ボールが こぼれ落ちるんじゃないか☆?」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 そこは野球部員を信じろだぜ☆」</p>
<pre><code>def surject(person1, person2):
"""
len(person1.boxes) >= len(person2.boxes)
"""
if len(person1.boxes) < len(person2.boxes):
print("Fail : I can not be satisfied. Src {}, Dst {}.".format(
len(person1.boxes), len(person2.boxes)))
return
destinations = []
for i in range(0, len(person1.boxes)):
destinations.append(i % len(person2.boxes))
random.shuffle(destinations)
for i in range(0, len(person1.boxes)):
person2.boxes[destinations[i]].extend(person1.boxes[i])
return
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 だらっと書いたが、サージェクションは こんな感じだろうか……☆?」</p>
<pre><code># Go!
print("radio> Starting line up.")
pitcher.show()
first.show()
second.show()
third.show()
catcher.show()
print("radio> The pitcher threw the ball towards first.")
first.clear_boxes()
surject(pitcher, first)
first.show()
print("radio> The first threw the ball towards second.")
second.clear_boxes()
surject(first, second)
second.show()
print("radio> The second threw the ball towards third.")
third.clear_boxes()
surject(second, third)
third.show()
print("radio> The third threw the ball towards catcher.")
catcher.clear_boxes()
surject(third, catcher)
catcher.show()
print("Info : Finished")
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 キャッチボールはできないんで、一方通行にするぜ☆」</p>
<pre><code>radio> Starting line up.
Pitcher : [ 2][ 3][ 5][ 7][11][13]
First : [][][][][]
Second : [][][][]
Third : [][][]
Catcher : [][]
radio> The pitcher threw the ball towards first.
First : [ 3, 13][ 2][ 7][11][ 5]
radio> The first threw the ball towards second.
Second : [ 2, 7][11][ 5][ 3, 13]
radio> The second threw the ball towards third.
Third : [ 5, 3, 13][ 2, 7][11]
radio> The third threw the ball towards catcher.
Catcher : [ 2, 7, 11][ 5, 3, 13]
Info : Finished
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/058791c2dd4c1604ce1bd9ec26d490ae5d2aae8b1f9f3.gif?mw=700" alt="OKAZAKI_Yumemi_80x80x8_02_Syaberu.gif" /></a><br />
「 箱が2個でも うまくキャッチしたものねぇ」</p>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 これは 鳩ノ巣原理☆?!」</p>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 まぐれ☆」</p>
<pre><code>radio> Starting line up.
Pitcher : [ 2][ 3][ 5][ 7][11][13]
First : [][][][][]
Second : [][][][]
Third : [][][]
Catcher : [][]
radio> The pitcher threw the ball towards first.
First : [ 2, 7][13][11][ 5][ 3]
radio> The first threw the ball towards second.
Second : [13, 11][ 5][ 2, 7][ 3]
radio> The second threw the ball towards third.
Third : [ 2, 7, 3][13, 11][ 5]
radio> The third threw the ball towards catcher.
Catcher : [ 2, 7, 3, 13, 11][ 5]
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 偏ることは よくある☆<br />
『よくある』がどれぐらいかの説明は 確率論に任せる☆ ここでは触れない☆」</p>
<h1 id="Bijection"><a href="#Bijection">Bijection</a></h1>
<p><a href="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3da2d4690cf2c3f101c5cbc0e48729f55d2aac5e16217.gif?mw=700" alt="KITASHIRAKAWA_Chiyuri_80x100x8_01_Futu.gif" /></a><br />
「 バイジェクションは最初にやったな☆」</p>
<pre><code>from my_lib.person import Person
from my_lib.jection import biject
# There are 5 peoples. Pitcher have six boxes.
pitcher = Person("Pitcher", [[2], [3], [5], [7], [11], [13]])
first = Person("First", [[], [], [], [], [], []])
second = Person("Second", [[], [], [], [], [], []])
third = Person("Third", [[], [], [], [], [], []])
catcher = Person("Catcher", [[], [], [], [], [], []])
# Go!
print("radio> Starting line up.")
pitcher.show()
first.show()
second.show()
third.show()
catcher.show()
print("radio> The pitcher threw the ball towards first.")
first.clear_boxes()
biject(pitcher, first)
first.show()
print("radio> First returned the ball to the pitcher.")
pitcher.clear_boxes()
biject(first, pitcher)
pitcher.show()
print("radio> The pitcher threw the ball towards second.")
second.clear_boxes()
biject(pitcher, second)
second.show()
print("radio> Second returned the ball to the pitcher.")
pitcher.clear_boxes()
biject(second, pitcher)
pitcher.show()
print("radio> The pitcher threw the ball towards third.")
third.clear_boxes()
biject(pitcher, third)
third.show()
print("radio> Third returned the ball to the pitcher.")
pitcher.clear_boxes()
biject(third, pitcher)
pitcher.show()
print("radio> The pitcher threw the ball towards catcher.")
catcher.clear_boxes()
biject(pitcher, catcher)
catcher.show()
print("radio> Catcher returned the ball to the pitcher.")
pitcher.clear_boxes()
biject(catcher, pitcher)
pitcher.show()
print("Info : Finished")
</code></pre>
<pre><code>radio> Starting line up.
Pitcher : [ 2][ 3][ 5][ 7][11][13]
First : [][][][][][]
Second : [][][][][][]
Third : [][][][][][]
Catcher : [][][][][][]
radio> The pitcher threw the ball towards first.
First : [ 7][ 5][ 3][11][13][ 2]
radio> First returned the ball to the pitcher.
Pitcher : [ 3][ 5][ 2][11][ 7][13]
radio> The pitcher threw the ball towards second.
Second : [ 7][13][ 3][11][ 5][ 2]
radio> Second returned the ball to the pitcher.
Pitcher : [ 7][ 3][13][ 5][ 2][11]
radio> The pitcher threw the ball towards third.
Third : [ 5][13][11][ 7][ 3][ 2]
radio> Third returned the ball to the pitcher.
Pitcher : [ 3][ 2][11][13][ 7][ 5]
radio> The pitcher threw the ball towards catcher.
Catcher : [ 7][ 2][ 5][ 3][11][13]
radio> Catcher returned the ball to the pitcher.
Pitcher : [ 2][ 5][ 7][11][13][ 3]
Info : Finished
</code></pre>
<p><a href="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5ac9fa3b390b658160717a7c1ef5008a5d2aae4919bb1.gif?mw=700" alt="KIFUWARABE_80x100x8_01_Futu.gif" /></a><br />
「 で、インジェクション、サージェクション、バイジェクション とは何だったのか……☆?」</p>
むずでょ