Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/692b2791-efd0-8000-b05e-3c2e0d9cb768
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== define W ladder path positions P0..P4 (staircase from bottom-right towards top-left) === P = [(6,6), (6,5), (5,5), (5,4), (4,4)] # (x,y) for x,y in P: board[y][x]='W' print("Initial W path:") print_board(board) gW = get_group(board, P[0][0], P[0][1]) print("W stones:", gW) print("Initial liberties:", liberties(board,gW), "count", len(liberties(board,gW))) Initial W path: A B C D E F G H I 9 . . . . . . . . . 8 . . . . . . . . . 7 . . . . . . . . . 6 . . . . . . . . . 5 . . . . β β . . . 4 . . . . . β β . . 3 . . . . . . β . . 2 . . . . . . . . . 1 . . . . . . . . . W stones: {(4, 4), (5, 5), (6, 5), (5, 4), (6, 6)} Initial liberties: {(3, 4), (4, 3), (6, 4), (6, 7), (4, 5), (7, 6), (5, 6), (5, 3), (7, 5)} count 9 B λ λ°°μΉ λ° λΌμ΄λΈλ¦¬ κ΄λ¦¬ W κ²½λ‘λ μ μ°κ²°λμμ΅λλ€. μ΄μ B λμ λ°°μΉνμ¬ W κ·Έλ£Ήμ λΌμ΄λΈλ¦¬λ₯Ό 1λ‘ μ€μ¬μΌ ν©λλ€. μ΅μ’ λΌμ΄λΈλ¦¬λ₯Ό μΈλΆ κ²½κ³μ λκ³ , μ΄λ₯Ό μ μΈν λλ¨Έμ§ λΌμ΄λΈλ¦¬μ B λμ λ°°μΉνλ©΄μλ W κ·Έλ£Ήμ΄ μΊ‘μ³λμ§ μλλ‘ μ£Όμν΄μΌ ν©λλ€. νμΈ ν μ§νν©λλ€. Bλ λ°°μΉ ν΅ν W κ·Έλ£Ή λ°©μ΄ νμΈ def add_attackers(board, W_start, final_lib): gW = get_group(board, W_start[0], W_start[1]) libs = liberties(board, gW).copy() libs.discard(final_lib) for L in list(libs): x,y = L # skip if final_lib if L == final_lib: continue new_b = place_move(board, x,y,'B') if new_b is None: # illegal (suicide) or captured W; skip placing B here continue # ensure W group still has at least 1 liberty gW_new = get_group(new_b, W_start[0], W_start[1]) libs_new = liberties(new_b, gW_new) if len(libs_new)==0: # cannot place here (captures W, we want atari but not capture yet) continue # accept placement board = new_b return board board2 = copy_board(board) final_lib = (3,4) board2 = add_attackers(board2, P[0], final_lib) print_board(board2) gW2 = get_group(board2, P[0][0], P[0][1]) print("Libs after adding attackers:", liberties(board2,gW2), "count", len(liberties(board2,gW2))) A B C D E F G H I 9 . . . . . . . . . 8 . . . . . . . . . 7 . . . . . . . . . 6 . . . . β β . . . 5 . . . . β β β . . 4 . . . . β β β β . 3 . . . . . β β β . 2 . . . . . . β . . 1 . . . . . . . . . Libs after adding attackers: {(3, 4)} count 1 보λ μν μ κ² μ΄μ W κ·Έλ£Ήμ΄ μ νν 1κ°μ λΌμ΄λΈλ¦¬λ₯Ό κ°μ‘κ³ , B λμ΄ μ μ ν λ°°μΉλμμ΅λλ€. W 체μΈμ λκ°μ ννλ‘ λ³΄μ΄κ³ , Bλ μΈλΆ κ²½λ‘λ₯Ό λ°λΌ λ°°μΉλμμ΅λλ€. 보λ λ μ΄μμμ 9x9 λ°©μμΌλ‘ μ¬κ²ν ν ν, λ―ΈμΈ μ‘°μ μ΄ νμν μ μμ΅λλ€. 보λ μ’ν λ§€ν μ κ² λ³΄λμμ κ° μμΉλ₯Ό νμΈνλ©΄μ νμν μ’νλ€μ μ°Ύκ³ μμ΅λλ€. W λμ μ€μ λ‘ E5, F5, F4, G4, G3μ μμΉνκ³ μκ³ , ν΄λΉ μ’νμ λν΄ μ ννκ² λ§€νλμμ΅λλ€. λ€μ λ§ν΄, E5μμ G3κΉμ§ W λλ€μ΄ μλ§κ² λ°°μ΄λμ΄ μμμ νμΈνμμ΅λλ€. μ’νμ 보λ νμΈ W λμ κ²½λ‘λ μ νν E5μμ G3κΉμ§ νμ±λ Lμ κ²½λ‘μ λλ€. κ° λμ E5, F5, F4, G4, G3μ μμΉνκ³ μμ΅λλ€. μ΄μ B λμ λν΄, F6, G5, E6, H4, G2 λ±μ νμΈνμ΅λλ€. μ΄λ€μ λ°νμΌλ‘ B λμ μμΉλ₯Ό μ’ λ λͺ νν νκ² μ΅λλ€. μ’ν μΆμΆ λ° κ²½λ‘ μΆμ
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)