Posted: Fri May 02, 2008 5:41 pm Post subject: Re: "How Much You Suck" Program
Quote:
Tell you what. If your going to spend 137 lines doing something, make it something useful, like a "zomg l33t halo game!" or something. As a general rule, if stupid programs like this take you over 20 lines of code to write, you fail epically.
Have a nice day.
What a superb post. I think that in those few sentences, I felt all of a dozen emotions I couldn't name. Rarely, if ever, does one see such an eloquent, yet succinct expression of disgust as did I see in your poetic post. I tell you, it takes a rare kind of genius to commit such immortal meaning to mortal language, the like of which has not been seen since the days of Henry David Thoreau.
Truly, you are a one destined for greatness.
Allow me, humble and unworthy peon that I am, to follow in your footsteps, as I would in those of King Wenceslas; the snow that impedes us in life is deep, and the wind sharp, but I know that at the degree of your resplendent skill and ingenuity, I shall not want.
Unwise as I am, and as you are such a big boy (no Pampers for this one!), I have but to ask: Please, DarkFrogFTW, be my leader.
Sponsor Sponsor
jinjin
Posted: Fri May 02, 2008 10:12 pm Post subject: Re: "How Much You Suck" Program
As was aforementioned, some of the for loops are unneeded or improperly executed. Therefore, I suggest you review the excellently detailed tutorial on loops and for loops by Cervantes here: http://compsci.ca/v3/viewtopic.php?t=3678. It will surely aid in making your code more efficient, thereby saving both yourself and the user time.
Furthermore, I would suggest that, at the ending of the program, another representation of how much the user "sucks" is run such as a picture, sound, or animation as the last output line simply stating a percentage is somehow ... anti-climatic.
As a simple side note, I would also recommend that, when you test this program (or any program for that matter), you should explore all of the different scenarios possible in terms of the user input in order to ensure that it runs smoothly and is completely error-free.
Regards,
jinjin
Clayton
Posted: Fri May 02, 2008 10:58 pm Post subject: RE:"How Much You Suck" Program
Posted: Sat May 03, 2008 1:18 pm Post subject: Re: "How Much You Suck" Program
Zampano @ Fri May 02, 2008 5:41 pm wrote:
Unwise as I am, and as you are such a big boy (no Pampers for this one!), I have but to ask: Please, DarkFrogFTW, be my leader.
Your Sarcasm bounces off my big, boyish exterior . And come on, I thought I was being quite nice! I even wished him a nice day...
Anyways. To A/V. Out of curiosity, I wondered if I could get this program down to under the 20 lines I suggested was the "fail limit"... and I wasn't quite able to get it. With Input error checking, put statements for incorrect answers, converting to lowercase, and the cls, the total came up to 25. With all that stuff removed, though, it is exactly 20 (but perhaps there is better...). Note in both cases there is no blank lines or comments. So yeah, I failed, and you can rub it in all you like.
The biggest line killer was definately this:
const CharValues : array 1..26 of nat2 := init(bla bla bla..)
where "bla bla bla..." is the numbers you were assigning each letter, in "Alphabetical order", if that makes sense. like, if you had something like
code:
if YourString(Index) = "a" then
total := total + 40
end if
then the number 40 would go into the first slot of the array, followed by a comma, then the value for b...
what this allows you to do is this:
code:
for Index : 1..StringLength
total := total + CharValues(ord(YourString(Index))-96)
end for
"ord", if you didn't know, returns the ascii value of a character. If you made a simple program that put the ord val of a letter, you'd find "a" is 97, "b" is 98, and so on. so when I take 97 ("a") and subtract 96 from it, bam, I'm asking it for the value found in CharValues(1), which is 40.
This effectively turns your 78 lines of if structures into 4; 3 for the loop, 1 for the array.