In this project we write a program in VM code to draw two nice patterns. Start with the template in pp12.zip.
Your task is to fill in the functions Pattern.lines and Pattern.disk in the file Pattern.vm. The main function Main.main tests all patterns with different parameters. You need to press any key to proceed to the next test. (You can also modify the main function for further testing.)
The function Pattern.lines(x, y, d) draws lines from the point \((x,y)\) to all points \((511,0), (511,d), (511, 2d), (511, 3d) \ldots\), as in this screenshot (which shows the result of calling the function two times).
The function Pattern.disk(x, y, r, xstep) fills a disk of radius \(r\), centered at \((x,y)\) with a zig-zag pattern that goes up and down. The \(x\)-coordinate increases by xstep in every zig-step, see the screenshot.
Upload Pattern.vm to our submission server.