Computer Science Canada need increasing levels of difficulty and upgraded graphiks |
Author: | jdubs [ Thu Oct 09, 2008 12:54 pm ] | ||
Post subject: | need increasing levels of difficulty and upgraded graphiks | ||
Mod edit: plagiarized from Euphoracle's code. For shame.
Mod Edit: Code tags inserted. National Disaster averted. |
Author: | Clayton [ Thu Oct 09, 2008 2:10 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
No. We will not do this for you. We can help, but in the end you need to do the work for yourself. |
Author: | SNIPERDUDE [ Thu Oct 09, 2008 2:47 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
CODE. TAGS. For increasing difficulty try to work out an algorithm for your self (psuedo-code) on paper, then put it in Turing. For graphics look into all of Turing's various graphics functions and work out how YOU want it to look. Like Clayton said we aren't going to do this for you. |
Author: | isaiahk9 [ Thu Oct 09, 2008 4:13 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
Just a note on program effectiveness, jdubs - it looks like you use unnecessary variables. You declared variables for the color of paddles and their x coordinates for example (which never change so they don't need to be variables, they can be just normal numbers). And it seems that you put a ton of work into Pong, which can feasibly be made in Turing with half the code. Nice job on the AI though. |
Author: | Tony [ Thu Oct 09, 2008 4:33 pm ] |
Post subject: | Re: RE:need increasing levels of difficulty and upgraded graphiks |
isaiahk9 @ Thu Oct 09, 2008 4:13 pm wrote: which never change so they don't need to be variables, they can be just normal numbers
The term is constants. Edit: and it appears that jdubs is already using them. |
Author: | isaiahk9 [ Thu Oct 09, 2008 5:10 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
yeah, the word constants just slipped my mind I meant for example variables like : const BALL_COLOR := blue Instead of writing out that code, why doesn't he just put "blue" instead of BALL_COLOR, and 25 instead of his variable for paddle x coordinates. it's not a big deal, but I thought it made a difference. |
Author: | [Gandalf] [ Thu Oct 09, 2008 6:10 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
It's good practice. Now whenever he wants to change one of those constants, he doesn't have to search for it in his code and try to understand what's going on, he can just look at the start of the code and read the clear variable names. Also, if he's using the constant in multiple places, he doesn't have to do a search/replace, he only has to change one constant variable. Also, I believe the word you were originally looking for was literal, 5 is a literal, while const foo : int := 5 makes foo a constant. |
Author: | isaiahk9 [ Thu Oct 09, 2008 6:27 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
Yeah, I meant literal. And yes, I realize that your method is more effective in long programs (if you would call this a long program). |
Author: | [Gandalf] [ Thu Oct 09, 2008 6:51 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
Yes, I definitely think it's better to use good practice in non-trivial programs, unless you're going for a shortest program award, of course. ![]() Note also that the above code was plagiarized from Euphoracle. |
Author: | Tony [ Thu Oct 09, 2008 7:53 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
Even if the program isn't "long", in this case constants are organized into something resembling a block of configuration values. If you want to tweak the rules of gameplay, it's all in one place. @isaiahk9 -- from your earlier post, I suspect that you might be concerned that constants take up memory space. They don't. Instances of the constant are replaced by their literal value at compile-time. Though even if they weren't (if they were variables instead), it would only take up O(1) memory. |
Author: | Euphoracle [ Thu Oct 09, 2008 8:07 pm ] |
Post subject: | RE:need increasing levels of difficulty and upgraded graphiks |
Hey, that's my ugly code! He removed my safety goggles comment ![]() http://compsci.ca/v3/viewtopic.php?p=170407#170407 |
Author: | Clayton [ Thu Oct 09, 2008 8:09 pm ] |
Post subject: | Re: RE:need increasing levels of difficulty and upgraded graphiks |
Gandalf @ Thu Oct 09, 2008 6:51 pm wrote: Yes, I definitely think it's better to use good practice in non-trivial programs, unless you're going for a shortest program award, of course.
![]() Note also that the above code was plagiarized from Euphoracle. This has been noted. Since the code has been plagiarized, and no credit was given, I will lock this for now. A decision may be made later with what to do with this topic. EDIT: Damn you and your name Gonflag! Wizard edit: Teeheeho! |