spiral()
method?
You must provide a method called doit(page)
taking the page number
to draw as parameter. Its code is as following, with A0, B0, etc being integers.
The goal of this exercise is to find the good values for each page, which requires to
correctly understand how the spiral method works.
[!java]void [/!]doit([!java]int [/!]page[!scala]:Int[/!])[!python]:[/!][!java|scala] {[/!] [!java]switch (page) {[/!][!scala]page match {[/!][!python] # select on the value of page[/!] [!java]case 0:[/!][!scala]case 0 =>[/!][!python]if page==0:[/!] [!java|scala]//[/!][!python]#[/!] Drawing of the first page, dubbed "One" spiral(A0,B0,C0,D0); [!java] break;[/!] [!java]case 1:[/!][!scala]case 1 =>[/!][!python]if page==1:[/!] [!java|scala]//[/!][!python]#[/!] Drawing of the second page, dubbed "Two" spiral(A1,B1,C1,D1); [!java] break;[/!] [!java]case 2:[/!][!scala]case 2 =>[/!][!python]if page==2:[/!] [!java|scala]//[/!][!python]#[/!] Drawing of the page dubbed "Three" spiral(A2,B2,C2,D2); [!java] break;[/!] [!java]case 3:[/!][!scala]case 3 =>[/!][!python]if page==3:[/!] [!java|scala]//[/!][!python]#[/!] Drawing of the page dubbed "Four" spiral(A3,B3,C3,D3); [!java] break;[/!] [!java]case 4:[/!][!scala]case 4 =>[/!][!python]if page==4:[/!] [!java|scala]//[/!][!python]#[/!] Drawing of the page dubbed "Five" spiral(A4,B4,C4,D4);[!java|scala] [!java] break;[/!] } }[/!]
No need to copy over the method of spiral()
, the turtle of this
exercise already knows it.