|
1 | 1 | # `no_spoon.py` - a CodinGame challenge |
2 | | -# ============================================================================== |
| 2 | +# ===================================== |
3 | 3 | # |
4 | 4 | # This file demonstrates the use of literate programming in solving the |
5 | | -# ["There is no Spoon"](https://www.codingame.com/ide/puzzle/there-is-no-spoon-episode-1) |
| 5 | +# [There is no Spoon](https://www.codingame.com/ide/puzzle/there-is-no-spoon-episode-1) |
6 | 6 | # programming challenge. |
7 | 7 | # |
| 8 | +# Imports |
| 9 | +# ------- |
| 10 | + |
| 11 | +import sys |
| 12 | +import math |
| 13 | + |
8 | 14 | # Input |
9 | | -# ------------------------------------------------------------------------------ |
| 15 | +# ----- |
| 16 | +# |
| 17 | +# Don't let the machines win. You are humanity's last hope... |
10 | 18 | # |
11 | 19 | # First, read the input provided by the challenge: |
12 | 20 | # |
13 | 21 | # The number of cells on the X axis. |
14 | 22 | width = int(input()) |
15 | 23 | # The number of cells on the Y axis. |
16 | 24 | height = int(input()) |
17 | | -# Read the grid of cells: |
| 25 | +# Read in a grid of cell: |
18 | 26 | # |
19 | 27 | # * Each line is `width` characters. |
20 | 28 | # * The characters are either `0` (occupied) or `.` (empty). |
21 | 29 | # |
22 | 30 | # From the website, here's an example grid: |
23 | 31 | # |
24 | | -# <img src="example_grid.png" alt="" width="50%" height="50%"> |
| 32 | +#  |
25 | 33 | # |
26 | 34 | # The text which creates this grid is: |
27 | 35 | # |
|
30 | 38 | # 0. |
31 | 39 | # ``` |
32 | 40 | # |
33 | | -# Store this an an array of lines; each lines contains these characters. |
34 | | -# Therefore, `line[y][x]` gives the cell at the coordinate $(𝑥,𝑦)$ (note the |
| 41 | +# Store this an an array of lines; each line contains these characters. |
| 42 | +# Therefore, `line[y][x]` gives the cell at the coordinate $(x,y)$ (note the |
35 | 43 | # reversed order). |
36 | 44 | line = [] |
37 | 45 | for y in range(height): |
38 | 46 | line.append(input()) |
39 | 47 |
|
40 | 48 | # Processing and output |
41 | | -# ------------------------------------------------------------------------------ |
| 49 | +# --------------------- |
42 | 50 | # |
43 | 51 | # From the rules: |
44 | 52 | # |
|
0 commit comments