Visual basic math

35 points

We need to get some things calculated, so let's get to work.

Hit the problem endpoint and grab the image URL. The image will be a few lines of numbers and operations that you need to perform. Start with 0, go from top to bottom and figure out the final result. Careful! The numbers may get big. Make sure nothing overflows along the way.

To illustrate, an image roughly equivalent to:

+ 12 
- 10  
× 2

Should be treated as (((0 + 12) - 10) × 2) which equals 4.

A word on division: for ÷, the challenge uses floor division which may be slightly surprising. Floor division means that after dividing the numbers, the result is rounded down. This means that -10 ÷ 3 is equal -4 (the floor of -3.(3) is -4)! Keep this quirk in mind.

Submit the final result the the solution endpoint. It's done!

Getting the problem set

GET /challenges/visual_basic_math/problem?access_token=...

Problem JSON:

  • image_url: the URL of the image we want you to process

Submitting a solution

POST /challenges/visual_basic_math/solve?access_token=...

Solution JSON structure:

  • result: the result of all the math

Why this challenge?

It's always interesting to make a computer really read things.

You too can support h^ by buying me a coffee. Cheers!
Also, I'd love to hear from you. Whatever you got, drop me an email. My h^ profile is here.