Challenge: Validate a code - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: Challenge: Validate a code (/thread-1599.html) |
Challenge: Validate a code - Moneo - 07-29-2003 Ok, Meg, your approach sounds ingenious. I've never used PSET and POINT commands, so I don't really understand how it's supposed to work. The fact is, however, that it doesn´t work. It only likes small code numbers less than 500. I made several versions of the VALID.TXT file but any valid number greater than 400 is marked as invalid by your program. Must be a minor coding error. Or maybe I need to add some switch to the BC compiler. ***** Fixed - Meg - 07-29-2003 Yeah I had a "480" instead of a "640"; just a typo. All fixed, now. You don't need any fancy switches or anything. It just uses the screen to store the information, which means you don't need to create any additional arrays. The code is pretty straightforward. Open up the data file, read in the values, and plot points on the screen: i.e. if the number read in = 0, plot a point at (0, 0) if the number read in = 1, plot a point at (1, 0) if the number read in = 639, plot a point at (639, 0) if the number read in = 640, plot a point at (0, 1) and so forth.. then, when the user enters codes, it just uses the POINT command to see whether the pixel which corresponds to that number has been lit up or not. *peace* Meg. Challenge: Validate a code - Moneo - 07-29-2003 MEG: Fantastic, It works 100%. Congratulations. Brilliant idea. I think we'll wait a day to see if Aga comes up with a solution, and then we'll declare a winner, which will be tough. ***** Challenge: Validate a code - Agamemnus - 07-29-2003 Signed integers are so much nicer sometimes... Blah.. I might not post anything... if i convert my array to LONG, it won't go as fast.... Challenge: Validate a code - Moneo - 07-29-2003 Aga, don't be concerned with speed for this. We're looking for design and simplicity. You must take into consideration that this program has a user interface. So, the user is not going to notice the difference of a few microseconds. ***** Challenge: Validate a code - Agamemnus - 07-29-2003 :| Challenge: Validate a code - Agamemnus - 07-29-2003 My entry. Uses longs! I know, BAD! Code: 'Is this BLITZTASTIC OR WHAT??!?!? Challenge: Validate a code - Moneo - 07-29-2003 Aga, Congratulations, it works! However, it looks a bit complicated. One small observation. On user input it allows leading, embedded, and trailing blanks on the numbers. Not exactly "clean", but that's my opinion. ***** Challenge: Validate a code - Agamemnus - 07-29-2003 Arr! I thought we already discussed that it removes all of that? aRr!!!! Challenge: Validate a code - Moneo - 07-29-2003 CODE VALIDATION CHALLENGE FINAL RESULTS: First Place: MEG. Brilliant solution and concise implementation. Tied for Second: ANTONI and BLITZ. Excellent solutions and implementations. Third: AGA. Very good, working solution. Fourth: STERLING. Participated. ***** |