Drawing boxes
Hello, Community!
Here's an interesting task I found on the Internet.
Problem description
Write a method that would draw a box of a specified size.
The goal is to write the shortest method.
Here's a method signature (it can't be modified):
ClassMethod main(s As %Integer = 10)
And call sample:
>do ##class(ITPlanet.Task4).main(5) ##### ## ## # # # ## ## ##### >do ##class(ITPlanet.Task4).main(10) ########## ## ## # # # # # # # # # ## # # ## # # # # # # # # # ## ## ########## >do ##class(ITPlanet.Task4).main(20) #################### ## ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## # # ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## ## ####################
Also, here's the code to check your result length:
ClassMethod length(class = {$classname()}, method = "main") As %Integer
{
#dim methodObj As %Dictionary.MethodDefinition
set methodObj = ##class(%Dictionary.MethodDefinition).IDKEYOpen(class, method)
quit methodObj.Implementation.Size
}
My best result is 91 76 so far.
What's yours? ;)