Question
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
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 Testing Your Code When you are ready, right-mouse-click to save the file driver to the same directory as your project3.py. Also download and save the tests3v9_sample.txt to the same directory. You can then run your code against our test cases through the terminal with the command" python driver3_sample.py This will test your code on the same test cases as Marmoset, and give you a report. Once you've passed as many tests as you can, upload your submission to Marmoset using the instructions at the bottom of the page. Code Templates Download the code project3.py answer template for this assessment. Right-mouse click and save the file as project3.py. Its contents are as follows: def getMirrorMirror(width, height, tile1): width = width height = height tile1 = tile1 #YOUR CODE GOES HERE (indented) return "fixme" #END YOUR CODE Download the supporting file SystemCall for this assessment. Right-mouse click to save the file as SystemCall.java. Download the supporting file code support files for this assessment. Right-mouse click and save the file as code.py.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started