###
Each Tag

challenge
###
Common tags - number of posts

calculator (2),
programming (2),
stack (2),
TrickleUp Effect (1),
solution (1),
code (1),
recursion (1),
queue (1),
Towers of Hanoi (1),

##
2 way join

calculator, challenge, challenge, programming, challenge, stack

article posted by

Brian on 2005 May 11th at 16:14, 1

comment
Here's a new software challenge for us all. Take my project Towers of Hanoi and make it work. The goal is to write a recursive function to solve the game. Please print the towers after each iteration. The skeleton is already written. Just implement towers::execute().

A makefile is included. You may create new files, though i'm not sure that's necessary.

Please put your comments about the challenge under this "article" or email me directly.

I got the logic working last week and finally cleaned up input and output for my submission to my challenge. The executable is 19,394 bytes.

One caveat: the internal data type for numbers is an int. So there are problems with precision on division.

The main function solve() is recursive, but really doesn't have to be.

The source code is here.

Implement a stack. Use it to evaluate a simple mathematical expression. This expression will not have parentheses. It will use only plus, minus, multiply, and divide operators. The operands (input) will be integers, although output may be rational due to division. You may or may not use recursion. All code must be written by you.

Of course i'd like to see recursion. But if you think that's impossible then don't. When you see my example you will be proven wrong.

You swap out a stack for another data structure, but once again, don't wimp out.

Any code that is not used is seen wasteful and a bore to my eyes.

When you see my example you will be proven wrong.Your example, eh? :) BTW.. Im altering my queue into a stack and omitting my additional challenge of solving an equation. Perhaps if I get bored someday Ill finish the challenge, but (as those of you on SILC know..) Im too frustrated at my waste of time thusfar to continue.notify me: yes