HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

You have no respect for logic

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
youlogicforrespecthave

Problem

Inspired by Hosch250, TopinFrassi, Legato and the recent milestone of having our 100th fizzbuzz question on Code Review I decided to add an ArnoldC FizzBuzz to the collection.

I haven't found any best practices about the language, but I assume the code needs to be VERBOSE. For those unfamiliar with the language, a small excerpt of the keywords:

True              NO PROBLEMO
ModuloOperator    I LET HIM GO
DeclareInt        HEY CHRISTMAS TREE
AssignVariable    GET TO THE CHOPPER


The challenge itself doesn't need introduction. Write all numbers from 1 up till and including 100, but:

  • Write Fizz instead of the number when divisible by 3



  • Write Buzz instead of the number when divisible by 5



  • Write FizzBuzz instead of the number when divisible by 15



`LISTEN TO ME VERY CAREFULLY modulo
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE dividend
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE divisor
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE quotient
YOU SET US UP 0
HEY CHRISTMAS TREE remainder
YOU SET US UP 0
HEY CHRISTMAS TREE product
YOU SET US UP 0
GET TO THE CHOPPER quotient
HERE IS MY INVITATION dividend
HE HAD TO SPLIT divisor
ENOUGH TALK
GET TO THE CHOPPER product
HERE IS MY INVITATION divisor
YOU'RE FIRED quotient
ENOUGH TALK
GET TO THE CHOPPER remainder
HERE IS MY INVITATION dividend
GET DOWN product
ENOUGH TALK
I'LL BE BACK remainder
HASTA LA VISTA, BABY

LISTEN TO ME VERY CAREFULLY divisible
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE dividend
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE divisor
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE result
YOU SET US UP 0
GET YOUR ASS TO MARS result
DO IT NOW modulo dividend divisor

HEY CHRISTMAS TREE isZero
YOU SET US UP 0
GET TO THE CHOPPER isZero
HERE IS MY INVITATION result
YOU ARE NOT YOU YOU ARE ME 0
ENOUGH TALK

I'LL BE BACK isZero
HASTA LA V

Solution

There's incorrect/inconsistent indentation in:

HEY CHRISTMAS TREE result
YOU SET US UP 0


and

HEY CHRISTMAS TREE isZero
YOU SET US UP 0


The ArnoldC wiki says you should declare 0s and 1s as the "macros" @I LIED and @NO PROBLEMO

HEY CHRISTMAS TREE isZero
    YOU SET US UP @I LIED


In your method divisible, the end of method statement is not on the same indentation as the start declaration.

The indentation in these two blocks is two vs four:

IT'S SHOWTIME
    HEY CHRISTMAS TREE maxValue


and:

LISTEN TO ME VERY CAREFULLY divisible
  I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE dividend


You ought to stick to one consistently.

IT'S SHOWTIME
    HEY CHRISTMAS TREE maxValue
    YOU SET US UP @NO PROBLEMO


There we go! Using the macros!

Oh, wait...

HEY CHRISTMAS TREE n
YOU SET US UP 0


Never mind...

And again...

HERE IS MY INVITATION n
        GET UP 1

Code Snippets

HEY CHRISTMAS TREE result
YOU SET US UP 0
HEY CHRISTMAS TREE isZero
YOU SET US UP 0
HEY CHRISTMAS TREE isZero
    YOU SET US UP @I LIED
IT'S SHOWTIME
    HEY CHRISTMAS TREE maxValue
LISTEN TO ME VERY CAREFULLY divisible
  I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE dividend

Context

StackExchange Code Review Q#112825, answer score: 18

Revisions (0)

No revisions yet.