Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mirror of a grid
#1
Imagine that the user specifies with width and height of a grid, and a tile in that grid. Find the "mirror-mirror" of that tile, that is, if you folded the grid in half, and then folded it in half again, the tile that the original tile overlaps is its mirror-mirror (think of folding a sheet of paper in half, and then folding it in half again along the other axis). For example, for a 7x10 grid:

1 2 3 4 5 6 7
8 9 14
15 16
22 23 24 25 26 27 28
29 32
36 40
43 44 48
50 56
57 63
64 65 66 67 68 69 70

the mirror-mirror of tile 27 would be tile 44.

You may use the following formulas in your solution as needed:

row = (tile - 1) // width

column = (tile - 1) % width
Reply


Messages In This Thread
Mirror of a grid - by beatyjl - Sep-27-2017, 04:55 PM
RE: Mirror of a grid - by nilamo - Sep-27-2017, 04:57 PM
RE: Mirror of a grid - by beatyjl - Sep-27-2017, 04:58 PM
RE: Mirror of a grid - by nilamo - Sep-27-2017, 05:02 PM
RE: Mirror of a grid - by nilamo - Sep-27-2017, 06:34 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020