SlideShare a Scribd company logo
1 of 37
N-Puzzle의 Solvability
https://www.youtube.com/watch?v=9bQ7nDAcsM8
`
N-Puzzle이란
• 1880년대 초반 유행한 슬라이딩 퍼즐.
• 개수에 따라 8-Puzzle, 15-Puzzle, 24-Puzzle 등이 가능
• 목표
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
특정 상태
2019-01-02 2
`
Solvability
N-Puzzle은 (N+1)!개의 상태를 가진다. 모든 상태는 두가지 class
로 나뉜다. 각 상태는 자신과 같은 class에 속한 상태로만 변환이
가능하고, 다른 class의 상태로는 변환 할 수 없다.
2019-01-02 3
`
용어
• Counter: 움직일 수 있는 퍼즐 조각. 15-Puzzle엔 15개의 counter 존재
• Square: counter가 존재 할 수 있는 퍼즐 안의 작은 공간. 15-Puzzle엔
16개의 counter 존재
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
2019-01-02 4
`
용어
• Vacant Square: 현재 비어 있는 square
• Blank Square: 마지막 열의 맨 오른쪽에 위치한 square
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
2019-01-02 5
`
용어
Move: counter를 vacant square로 이동하는 행위
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
2019-01-02 6
`
용어
Transfer: blank square에 있는 counter를 vacant square로 이동하는 행위
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
2019-01-02 7
`
용어
Interchange: 두 counter를 서로 바꾸는 행위
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 6 8
9 11 10 12
13 14 15 7
2019-01-02 8
`
규칙 1
n+1 move -> transfer
= n move->transfer->single interchange
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 7 6 8
9 10 11 12
13 14 15
nth move (n+1)th move transfer
2019-01-02 9
`
규칙 1
n+1 move -> transfer
= n move->transfer->single interchange
1 2 3 4
5 6 8
9 10 11 12
13 14 15 7
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1 2 3 4
5 7 6 8
9 10 11 12
13 14 15
nth move transfer interchange
2019-01-02 10
`
규칙 2
one move -> transfer = Initial State
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1st move transfer
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
2019-01-02 11
`
규칙 3
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1st move 2nd move
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
two moves -> transfer = single interchange (by 규칙1 when n=1)
2019-01-02 12
`
규칙 3
two moves -> transfer = single interchange (by 규칙1 when n=1)
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
Transfer
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
2019-01-02 13
`
규칙 4
n move -> transfer
= (n-1) move -> transfer -> 1 interchange (by 규칙1)
= (n-2) move -> transfer -> 2 interchange (by 규칙1)
= …
= 1 move -> transfer -> n-1 interchange (by 규칙1)
= n-1 interchange (by 규칙2)
2019-01-02 14
`
규칙 5
nth move 후에 blank square가 vacant square가 될 때
n move
= (n-1) move -> transfer (nth move는 transfer와 동일)
= (n-2) interchange (by 규칙 4)
2019-01-02 15
`
nth move 후에 blank square가 vacant square가 될 때 n은 항상 짝수이다
• 퍼즐의 각 칸에 교대로 검은색과 흰색을 칠했을 경우 검은 칸에서는 흰
칸으로만, 흰 칸에서는 검은 칸으로만 움직일 수 있다
• 처음에 vacant square가 검은 칸이었을 경우, n move 후에 다시 검은 칸
이 되기 위해서는 n이 짝수여야 한다. vacant square가 처음에 흰 칸인
경우도 마찬가지다.
규칙 6
2019-01-02 16
`
규칙 5, 규칙 6 예시
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
1 2 3 4
5 7 8 12
9 6 11 15
13 10 14
8 move
14 <-> 15 + 10 <-> 15 + 6 <-> 15
+ 7 <-> 15 + 8 <-> 15 + 12 <-> 15
= 6 interchange
2019-01-02 17
`
규칙 5에 의해 정답 상태에서 n move 후 다시 blank square가 vacant square로 되기 위해서는
n개의 interchange가 필요하다. 또한 규칙 6에 따라 n은 짝수여야 한다. 따라서 정답 상태로부
터 홀수개의 interchange를 필요로 하고 blank가 square인 상태로 갈 수 없다. 그리고 그 상태
에서 갈 수 있는 다른 상태들 또한 갈 수 없다. 이렇게 N-Puzzle의 모든 상태는 두가지 class로
나뉜다
증명
2019-01-02 18
`
현재 상태가 정답 상태로 변환할 수 있는지 어떻게 알 수 있을까?
1. 현재 상태 => blank square가 vacant square인 상태로 변환
2. interchange 개수 새기
의문
2019-01-02 19
`
1. 변환
홀수일때
짝수일때
2019-01-02 20
`
2. Interchange 수 세기
• Permutation 생성
1 2 3
4 5 6
7 8
8 3 1
5 4 6
7 2
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
𝜎 =
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
2019-01-02 21
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1
2019-01-02 22
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8
2019-01-02 23
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2
2019-01-02 24
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3
2019-01-02 25
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1)
2019-01-02 26
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4
2019-01-02 27
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4
2019-01-02 28
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5)
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4
2019-01-02 29
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5)(6)
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5)
2019-01-02 30
`
set = {1, 2, … , n}
while set exist {
pop s from set
create cycle and add s
x = value under row1 at s
while s != x {
add x to cycle
x = val under row1 at x}
close cycle}
2. Interchange 수 세기
• Cycle로 분할
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5)(6)(7)
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5)(6)
1 2 3 4 5 6 7 8
8 3 1 5 4 6 7 2
1 8 2 3 1) 4 5)
2019-01-02 31
`
2. Interchange 수 세기
• Cycle로 분할
1 2 3 8
8 2 3 1
8 1 3 2
8 3 1 2
4 5
5 4
6
6
7
7
1 <-> 8
1 <-> 2
1 <-> 3 4 <-> 5
no interchange no interchange
Total 4 cycles, 4 interchanges
2019-01-02 32
`
• 길이가 n인 permutation을 m 개의 사이클 c1, c2, … , cm 으로 분할
• 사이클 ck 의 길이를 lk라 할 때 각 사이클은 lk − 1 interchange 가능
• 전체 interchange 수 = 각 cycle interchang수 = lk − 1 = 𝑛 − 𝑚
• n – m 이 짝수일때 변환 가능!
2. Interchange 수 세기
2019-01-02 33
`
더 쉬운 방법
• 모든 move는 vacant square의 taxicab distance와 permutation의 cycle 수를
1씩 바꾼다
• 따라서 taxicab distance와 cycle 수의 합의 parity는 불변
2019-01-02 34
`
더 쉬운 방법
1 2 3
4 5 6
7 8
1st move 2nd move
1 2 3
4 5 6
7 8
taxicab : 0
cycle : 9
parity(total) : 1
taxicab : 1
cycle : 8
parity(total) : 1
1 2 3
4 6
7 5 8
1 2 3
4 6
7 5 8
3rd move
taxicab : 2
cycle : 7
parity(total) : 1
taxicab : 3
cycle : 6
parity(total) : 1
2019-01-02 35
`
• 현대대수학
• Archer, Aaron F. (1999), "A modern treatment of the 15 puzzle
", The American Mathematical Monthly
• Wilson, Richard M. (1974), "Graph puzzles, homotopy, and the
alternating group", Journal of Combinatorial Theory, Series B, 16:
86–96
후속 공부
2019-01-02 36
`
• Johnson, Wm. Woolsey; Story, William E. (1879), "Notes on the "15" Puzzle", American
Journal of Mathematics, The Johns Hopkins University Press, 2 (4): 397–404
• https://en.wikipedia.org/wiki/15_puzzle
• https://en.wikipedia.org/wiki/Permutation
• https://en.wikipedia.org/wiki/Parity_of_a_permutation
참조
2019-01-02 37

More Related Content

Featured

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Solvability of n-puzzle

  • 2. ` N-Puzzle이란 • 1880년대 초반 유행한 슬라이딩 퍼즐. • 개수에 따라 8-Puzzle, 15-Puzzle, 24-Puzzle 등이 가능 • 목표 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 특정 상태 2019-01-02 2
  • 3. ` Solvability N-Puzzle은 (N+1)!개의 상태를 가진다. 모든 상태는 두가지 class 로 나뉜다. 각 상태는 자신과 같은 class에 속한 상태로만 변환이 가능하고, 다른 class의 상태로는 변환 할 수 없다. 2019-01-02 3
  • 4. ` 용어 • Counter: 움직일 수 있는 퍼즐 조각. 15-Puzzle엔 15개의 counter 존재 • Square: counter가 존재 할 수 있는 퍼즐 안의 작은 공간. 15-Puzzle엔 16개의 counter 존재 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2019-01-02 4
  • 5. ` 용어 • Vacant Square: 현재 비어 있는 square • Blank Square: 마지막 열의 맨 오른쪽에 위치한 square 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2019-01-02 5
  • 6. ` 용어 Move: counter를 vacant square로 이동하는 행위 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 2019-01-02 6
  • 7. ` 용어 Transfer: blank square에 있는 counter를 vacant square로 이동하는 행위 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2019-01-02 7
  • 8. ` 용어 Interchange: 두 counter를 서로 바꾸는 행위 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 6 8 9 11 10 12 13 14 15 7 2019-01-02 8
  • 9. ` 규칙 1 n+1 move -> transfer = n move->transfer->single interchange 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 7 6 8 9 10 11 12 13 14 15 nth move (n+1)th move transfer 2019-01-02 9
  • 10. ` 규칙 1 n+1 move -> transfer = n move->transfer->single interchange 1 2 3 4 5 6 8 9 10 11 12 13 14 15 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 7 6 8 9 10 11 12 13 14 15 nth move transfer interchange 2019-01-02 10
  • 11. ` 규칙 2 one move -> transfer = Initial State 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1st move transfer 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2019-01-02 11
  • 12. ` 규칙 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1st move 2nd move 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 two moves -> transfer = single interchange (by 규칙1 when n=1) 2019-01-02 12
  • 13. ` 규칙 3 two moves -> transfer = single interchange (by 규칙1 when n=1) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Transfer 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2019-01-02 13
  • 14. ` 규칙 4 n move -> transfer = (n-1) move -> transfer -> 1 interchange (by 규칙1) = (n-2) move -> transfer -> 2 interchange (by 규칙1) = … = 1 move -> transfer -> n-1 interchange (by 규칙1) = n-1 interchange (by 규칙2) 2019-01-02 14
  • 15. ` 규칙 5 nth move 후에 blank square가 vacant square가 될 때 n move = (n-1) move -> transfer (nth move는 transfer와 동일) = (n-2) interchange (by 규칙 4) 2019-01-02 15
  • 16. ` nth move 후에 blank square가 vacant square가 될 때 n은 항상 짝수이다 • 퍼즐의 각 칸에 교대로 검은색과 흰색을 칠했을 경우 검은 칸에서는 흰 칸으로만, 흰 칸에서는 검은 칸으로만 움직일 수 있다 • 처음에 vacant square가 검은 칸이었을 경우, n move 후에 다시 검은 칸 이 되기 위해서는 n이 짝수여야 한다. vacant square가 처음에 흰 칸인 경우도 마찬가지다. 규칙 6 2019-01-02 16
  • 17. ` 규칙 5, 규칙 6 예시 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 7 8 12 9 6 11 15 13 10 14 8 move 14 <-> 15 + 10 <-> 15 + 6 <-> 15 + 7 <-> 15 + 8 <-> 15 + 12 <-> 15 = 6 interchange 2019-01-02 17
  • 18. ` 규칙 5에 의해 정답 상태에서 n move 후 다시 blank square가 vacant square로 되기 위해서는 n개의 interchange가 필요하다. 또한 규칙 6에 따라 n은 짝수여야 한다. 따라서 정답 상태로부 터 홀수개의 interchange를 필요로 하고 blank가 square인 상태로 갈 수 없다. 그리고 그 상태 에서 갈 수 있는 다른 상태들 또한 갈 수 없다. 이렇게 N-Puzzle의 모든 상태는 두가지 class로 나뉜다 증명 2019-01-02 18
  • 19. ` 현재 상태가 정답 상태로 변환할 수 있는지 어떻게 알 수 있을까? 1. 현재 상태 => blank square가 vacant square인 상태로 변환 2. interchange 개수 새기 의문 2019-01-02 19
  • 21. ` 2. Interchange 수 세기 • Permutation 생성 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 𝜎 = 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 2019-01-02 21
  • 22. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 2019-01-02 22
  • 23. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2019-01-02 23
  • 24. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 2019-01-02 24
  • 25. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 2019-01-02 25
  • 26. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 2019-01-02 26
  • 27. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 2019-01-02 27
  • 28. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 2019-01-02 28
  • 29. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5) 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 2019-01-02 29
  • 30. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5)(6) 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5) 2019-01-02 30
  • 31. ` set = {1, 2, … , n} while set exist { pop s from set create cycle and add s x = value under row1 at s while s != x { add x to cycle x = val under row1 at x} close cycle} 2. Interchange 수 세기 • Cycle로 분할 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5)(6)(7) 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5)(6) 1 2 3 4 5 6 7 8 8 3 1 5 4 6 7 2 1 8 2 3 1) 4 5) 2019-01-02 31
  • 32. ` 2. Interchange 수 세기 • Cycle로 분할 1 2 3 8 8 2 3 1 8 1 3 2 8 3 1 2 4 5 5 4 6 6 7 7 1 <-> 8 1 <-> 2 1 <-> 3 4 <-> 5 no interchange no interchange Total 4 cycles, 4 interchanges 2019-01-02 32
  • 33. ` • 길이가 n인 permutation을 m 개의 사이클 c1, c2, … , cm 으로 분할 • 사이클 ck 의 길이를 lk라 할 때 각 사이클은 lk − 1 interchange 가능 • 전체 interchange 수 = 각 cycle interchang수 = lk − 1 = 𝑛 − 𝑚 • n – m 이 짝수일때 변환 가능! 2. Interchange 수 세기 2019-01-02 33
  • 34. ` 더 쉬운 방법 • 모든 move는 vacant square의 taxicab distance와 permutation의 cycle 수를 1씩 바꾼다 • 따라서 taxicab distance와 cycle 수의 합의 parity는 불변 2019-01-02 34
  • 35. ` 더 쉬운 방법 1 2 3 4 5 6 7 8 1st move 2nd move 1 2 3 4 5 6 7 8 taxicab : 0 cycle : 9 parity(total) : 1 taxicab : 1 cycle : 8 parity(total) : 1 1 2 3 4 6 7 5 8 1 2 3 4 6 7 5 8 3rd move taxicab : 2 cycle : 7 parity(total) : 1 taxicab : 3 cycle : 6 parity(total) : 1 2019-01-02 35
  • 36. ` • 현대대수학 • Archer, Aaron F. (1999), "A modern treatment of the 15 puzzle ", The American Mathematical Monthly • Wilson, Richard M. (1974), "Graph puzzles, homotopy, and the alternating group", Journal of Combinatorial Theory, Series B, 16: 86–96 후속 공부 2019-01-02 36
  • 37. ` • Johnson, Wm. Woolsey; Story, William E. (1879), "Notes on the "15" Puzzle", American Journal of Mathematics, The Johns Hopkins University Press, 2 (4): 397–404 • https://en.wikipedia.org/wiki/15_puzzle • https://en.wikipedia.org/wiki/Permutation • https://en.wikipedia.org/wiki/Parity_of_a_permutation 참조 2019-01-02 37