Tony's code
Tony, as you may know, is working on learning the same programming language, and Larry also gave him the Roman numeral conversion assignment.
Tony had his source code with him, and he obliged on my request to print me a copy. It does the same thing, with pretty much the same results, buth with quite different methodolgy.
It's quite interesting, how the same task can, when starting from scratch, be accomplished in different ways. I use one function with nested "if" statements, that subtract from the input (based on a specific characteristic of the input) and add to the result. Tony has functions nested within functions, and each of those steps runs a "division with remainder" calculation.
Mathematically, as Ken pointed out, that's quite similar, as division is just repeated subtraction. But in terms of programming, they're definitely distinct attacks on the same problem.
Tony's Go boardgame program: I got a copy of that, but I figure I'll need to look at it *really* closely before I make head nor tail out of it.
0 Comments:
Post a Comment
<< Home