diff --git a/grace/programs/divisibleby3.grc b/grace/programs/divisibleby3.grc index 26130eb..da8f9c6 100644 --- a/grace/programs/divisibleby3.grc +++ b/grace/programs/divisibleby3.grc @@ -48,5 +48,5 @@ fun main() : nothing writeString(" is "); if divisibleBy3(n) # 1 then writeString("not "); - writeString("divided by 3.\n"); + writeString("divisible by 3\n"); } $ main diff --git a/grace/programs/divisibleby3.result b/grace/programs/divisibleby3.result new file mode 100644 index 0000000..5e8c015 --- /dev/null +++ b/grace/programs/divisibleby3.result @@ -0,0 +1 @@ +54 is divisible by 3 diff --git a/grace/programs/evenodd.grc b/grace/programs/evenodd.grc index 321b5db..85f33ec 100644 --- a/grace/programs/evenodd.grc +++ b/grace/programs/evenodd.grc @@ -12,6 +12,14 @@ $$ fun main(): nothing + fun abs(n: int): int + { $ abs + if n < 0 then + return -n; + else + return n; + } + fun even(n: int): int; fun odd(n: int): int @@ -33,7 +41,7 @@ fun main(): nothing { $ main writeString("Please, give an integer: "); - if odd(readInteger()) = 1 then + if odd(abs(readInteger())) = 1 then writeString("odd\n"); else writeString("even\n"); diff --git a/grace/programs/evenodd.input b/grace/programs/evenodd.input new file mode 100644 index 0000000..84cfdfa --- /dev/null +++ b/grace/programs/evenodd.input @@ -0,0 +1 @@ +4711 diff --git a/grace/programs/evenodd.result b/grace/programs/evenodd.result new file mode 100644 index 0000000..c9c3c61 --- /dev/null +++ b/grace/programs/evenodd.result @@ -0,0 +1 @@ +Please, give an integer: odd diff --git a/grace/programs/functionestscope.result b/grace/programs/functionestscope.result new file mode 100644 index 0000000..0793a7c --- /dev/null +++ b/grace/programs/functionestscope.result @@ -0,0 +1,2 @@ +Test 1 Success +Test 2 Success diff --git a/grace/programs/hanoi.input b/grace/programs/hanoi.input index 7f8f011..ec63514 100644 --- a/grace/programs/hanoi.input +++ b/grace/programs/hanoi.input @@ -1 +1 @@ -7 +9 diff --git a/grace/programs/hanoi.result b/grace/programs/hanoi.result index 5e6f21b..d65e696 100644 --- a/grace/programs/hanoi.result +++ b/grace/programs/hanoi.result @@ -1,130 +1,514 @@ Please, give me the number of rings: Here is the solution: +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. -Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. -Move from middle to right. -Move from middle to right. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. -Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. -Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. -Move from right to left. -Move from right to left. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. -Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. -Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. -Move from left to middle. -Move from right to left. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. -Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. -Move from right to left. -Move from middle to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. -Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from left to middle. +Move from right to middle. Move from right to left. +Move from middle to left. +Move from right to middle. +Move from left to right. +Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. Move from middle to right. +Move from left to right. +Move from middle to left. +Move from right to middle. +Move from right to left. +Move from middle to left. Move from middle to right. +Move from left to right. Move from left to middle. +Move from right to middle. +Move from left to right. +Move from middle to left. +Move from middle to right. +Move from left to right. diff --git a/grace/programs/shortcircuit.result b/grace/programs/shortcircuit.result new file mode 100644 index 0000000..bc01615 --- /dev/null +++ b/grace/programs/shortcircuit.result @@ -0,0 +1,15 @@ +Checking if 1 is equal to 1. +'isOne' function called only for variable 'x'. + +Checking if n is a capital letter. +'isUpperCase' function call should only happen for variable 'k'. + +Checking if 41 is between 17 and 42. +Only 'isWithinLimit' function call should happen here. +Checking if 42 is between 17 and 42. +Checking if 42 is equal to 1. +'isOne' function call should only happen once here. + +Checking if 0 is equal to 1. +'isOne' function call should only happen once here. +'isWithinLimit' function call should never happen here. diff --git a/grace/programs/sierpinski.input b/grace/programs/sierpinski.input new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/grace/programs/sierpinski.input @@ -0,0 +1 @@ +5 diff --git a/grace/programs/sierpinski.result b/grace/programs/sierpinski.result new file mode 100644 index 0000000..93373c3 --- /dev/null +++ b/grace/programs/sierpinski.result @@ -0,0 +1,32 @@ +Please, give an integer (limit 6): * + * * + * * + * * * * + * * + * * * * + * * * * + * * * * * * * * + * * + * * * * + * * * * + * * * * * * * * + * * * * + * * * * * * * * + * * * * * * * * + * * * * * * * * * * * * * * * * + * * + * * * * + * * * * + * * * * * * * * + * * * * + * * * * * * * * + * * * * * * * * + * * * * * * * * * * * * * * * * + * * * * + * * * * * * * * + * * * * * * * * + * * * * * * * * * * * * * * * * + * * * * * * * * + * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *