Computer Science Canada Need a better, shorter version... |
Author: | TokenHerbz [ Sun Sep 25, 2005 12:48 am ] | ||
Post subject: | Need a better, shorter version... | ||
Hey, so in my RPG, to start off the battle scene, i wish to have a pokemon type closer... The problem, my vertions sloppy, crappy, and i believe extremely unessesary long code... A) I tryed to use a for inside a for statment to make this easy, but i just suck at thinking, and had problems, so i did it the long way, WHICH is kinda crappy... B) I ask for you to COPY - PASTE this, and run it, to get an idea of what i want to accomplish, Then i hope you are bored enough to make me a better, shorter verstion, Though if you dont, i would appreciate help on how i can shorted this code... ********* Here is the CODE
**Please help me out ** Byes! |
Author: | wtd [ Sun Sep 25, 2005 2:03 am ] | ||||||
Post subject: | |||||||
Well, this one won't make it shorter, but for the love of everything holy (or unholy, for that matter) please use more descriptive variable names! Also:
One word comes to mind immediately. That word is: record. I see x and y coordinates.
Then I see two sets of coordinates used together.
|
Author: | Cervantes [ Sun Sep 25, 2005 7:58 am ] | ||||||||
Post subject: | |||||||||
wtd wrote:
Indeed. I've used coordinate types such so often I just built them right into Turing, and made them pervasive. Now I've got them inside all sorts of built in functions.
is a lot more readable than
|
Author: | beard0 [ Sun Sep 25, 2005 11:29 pm ] |
Post subject: | |
Cervantes wrote: Indeed. I've used coordinate types such so often I just built them right into Turing, and made them pervasive. Now I've got them inside all sorts of built in functions.
Pray tell: how? I would love to do this. Unless you just mean having the same "include" line at the begining of every program... |
Author: | TokenHerbz [ Mon Sep 26, 2005 1:06 am ] |
Post subject: | |
Cervantes your good... But can you make one where it goes in a patter around? 2nd --->----->---->| ^ | 1st | \/ ^ | 3rd ex.. | \/ <----<----<---- 4th Alternating in colours, BUT SWITCHING on inners? So like this 1=black/2=yellow/3=black/4=yellow then on next inside 1=yellow/2=black/3=yellow/4=black then on next repeat i need somthing awsome, for my RPG battle enteries Infact i welcom all to post you code, ill make it a compitition though i just want an awsome one, short, cause i cant do it, my brain isn't pro yet... THANK!? |
Author: | Mr. T [ Mon Sep 26, 2005 6:53 am ] |
Post subject: | Alex Young |
People aren't just going to create large chunks of your code for you. Compsci is about learning, not blindly copying other's work. |
Author: | TokenHerbz [ Mon Sep 26, 2005 11:47 am ] |
Post subject: | |
aw ok, ill try more i just really suck at the part of **Making it small** i can code it, just it's large i cant make it in a few lines, which is mainly what i was looking for, though i guess i should learn how to eh, ill work on it |
Author: | Mr. T [ Mon Sep 26, 2005 4:16 pm ] |
Post subject: | Alex's Opinion |
Arrays are a powerful tool for writing efficient code. Read up on the various compsci tutorials. |
Author: | Cervantes [ Mon Sep 26, 2005 4:39 pm ] | ||||
Post subject: | |||||
beard0 wrote: Cervantes wrote: Indeed. I've used coordinate types such so often I just built them right into Turing, and made them pervasive. Now I've got them inside all sorts of built in functions.
Pray tell: how? I would love to do this. Unless you just mean having the same "include" line at the begining of every program... Add a new module in %oot/support/predefs. I think I called mine Type. It looks like this:
IIRC, the * means pervasive, and the ~. means export unqualified. Next step: Add this module to the predefs.lst file. If you want to be able to use these types within the other predef modules, you must add this line above the other modules. I put it just after anyclass.
Finished. tokenherbz wrote: But can you make one where it goes in a patter around? Perhaps. Not at the moment. |
Author: | [Gandalf] [ Tue Sep 27, 2005 4:19 pm ] |
Post subject: | |
1. Make your code any way you know how. 2. Shorten it. 3. Change it according to the shortening. 4. Repeat 2&3 continuously. |
Author: | codemage [ Wed Sep 28, 2005 7:46 am ] | ||
Post subject: | |||
1 quick example of an intro along that theme. I thought circles would look a bit more interesting - although a bit less '8-bit'. I tried to upload as a file attachment - but it's not letting me. Here it is in all it's (lengthy - sorry) glory.
|