Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from math import ceil SIZE = 8 matrix = [] w_row = 0 w_col = 0 b_row = 0 b_col = 0 matrix_board = [] for board_row in range(SIZE, 0, -1): row_element = [f'{chr(97 + x)}{board_row}' for x in range(SIZE)] matrix_board.append(row_element) for row in range(SIZE): inner_list = input().split() for col in range(SIZE): if inner_list[col] == 'w': w_row = row w_col = col if inner_list[col] == 'b': b_row = row b_col = col matrix.append(inner_list) if not abs(b_col - w_col) == 1: if (SIZE - b_row) > w_row: print(f"Game over! White pawn is promoted to a queen at {matrix_board[SIZE - SIZE][w_col]}.") else: print(f"Game over! Black pawn is promoted to a queen at {matrix_board[SIZE - 1][b_col]}.") else: if abs(b_row - w_row) % 2 == 0: print(f"Game over! Black win, capture on {matrix_board[b_row + ceil(abs(b_row - w_row) / 2)][w_col]}.") else: print(f"Game over! White win, capture on {matrix_board[w_row - ceil(abs(b_row - w_row) / 2)][b_col]}.")
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)