Forgive me if I don't ask it how I mean to.
Ok, so let's say I have two lists and their contents are (list name: contents):
greet: hello, hi, bye, see you later
and
guy: Bob, Guy, Tobi, Paul
And let's say I wanted to pick one from each (eg: hello Bob, or see you later Guy) and then store the combined product into a variable and then that variable into a list.
The catches are:
Each combination can only be used once, though the individual greets and guys can be used more than once.
It has to assign the finished product to a player.
Each player can only have one combination.
If I did something like, Stalk 'hi Paul', the person with hi Paul would get a message like "Someone is stalking you."
((I feel like I forgot something, but ah well, that just means I forgot a vital detail.))
Ok, so yah, if I didn't lose you in my lack of sensible wording, can you help me?
((And yes, I made up all these proxy lists and verbs on the spot.))
1
2
ID:159909
Dec 23 2008, 8:22 am
|
|
Dec 23 2008, 12:58 pm (Edited on Dec 23 2008, 1:36 pm)
|
|
*Removed*
|
In response to Kozar's friend
|
|
Uh, please don't help people with programming until you're more familiar. That code is pretty bad.
|
In response to Popisfizzy
|
|
*Removed*
|
In response to Kozar's friend
|
|
That means nill. Quality does not correlate with code simply working.
|
In response to Popisfizzy
|
|
*Removed*
|
In response to Kozar's friend
|
|
Kozar's friend wrote:
but id rather have a code where i can understand everytihng thats happening and have it work rather than sum1 jus hand me a bunch of shortcuts etc with a bit of notation to explain little... Firstly, those aren't shortcuts (normally). They're things being done the proper way. It'd be like calling taking a plane from LA to Tokyo a shortcut compared to swimming there. Secondly, that attitude results in bad, bad code being spread along the forums. Superbike32 espoused that, and people doing good were much frustrated, and the quality of help went down a lot. |
This will get the cross-product of n number of lists:
proc/cross_product(...) Note that it concatenates things without any spaces, so include spaces in one of the lists, or modify the proc. Also, there is the possibility of duplicates, as it doesn't do any checking. For that, you could do this: proc/remove_duplicates(list/l) Now, I'm not quite sure what you mean for the other bits of your post. You're going to have to elaborate. |
In response to Popisfizzy
|
|
hmm.. see thats why i dont code like that... i dont understand half of whats going... so thats why i code in a basic way.. where everything is layed out and explained bit by bit....
|
In response to Kozar's friend
|
|
I explained exactly what's going on. Your code is just very inefficient and has several instances of redundancy, usr abuse, and useless returns. I'm sure I missed some other things in my quick glance-over.
|
In response to Popisfizzy
|
|
You Stated this code was for removing duplicates:
</dm> Note that it concatenates things without any spaces, so include spaces in one of the lists, or modify the proc. Also, there is the possibility of duplicates, as it doesn't do any checking. For that, you could do this: > proc/remove_duplicates(list/l) But accoridng to this if there is a duplicate selected, it wont add it to the list, but doesnt actually stop the duplicate from still being selected.. so in theory 2 ppl can have the same combination, and they both will recieve the message, there just wont be 2 instances in the list.. please correct me if im wrong and point out where.. coz i dont want this to be because of how new i am.. i just couldnt see it in there.. |
In response to Kozar's friend
|
|
He was vague and his post is poorly-worded. I did my best at understanding what he wanted. All that post will do is remove duplicates from one list. I.e., list(1, 2, 2, 3, 4, 5, 5, 5, 6, 6, 7, 9, 9) --> remove_duplicates() --> list(1, 2, 3, 4, 5, 6, 7, 9).
|
In response to Popisfizzy
|
|
if(args.len >= 2) I'm left a bit puzzled here. For the case the args.len equals 2, wouldn't args.Copy(3) be called and cause a runtime (out of bounds) error? |
var That might work, I'm not entirely sure however. I used objects, I'm not sure if this is the most efficient way. |
In response to Killerdragon
|
|
Don't give help if you can't program. You show no knowledge of good programming practices at all; I mean really, you indulged in the greatest programming sins of all. NEVER use usr in a proc, and NEVER use goto unless you're in a very very very deeply nested loop.
Popisfizzy's code will work (since you seem so unsure), it's much more efficient, and it's much easier to read. Plus, it doesn't use usr or goto. |
In response to Killerdragon
|
|
Killerdragon wrote:
That might work, I'm not entirely sure however. In cases such as that, its best to let someone else answer. |
In response to Jeff8500
|
|
Jeff8500 wrote:
Don't give help if you can't program. You show no knowledge of good programming practices at all; I mean really, you indulged in the greatest programming sins of all. NEVER use usr in a proc, and NEVER use goto unless you're in a very very very deeply nested loop. Hey Jeff, go suck it. Alathon, thanks. |
In response to Killerdragon
|
|
Hey Killerdragon, stop sucking it. It's true, that was terrible code, whereas Popisfizzy's was good. Go read the DM guide before you ever tell me to "suck it".
|
In response to Killerdragon
|
|
Killerdragon wrote:
Hey Jeff, go suck it. Thing is, he was right. Your code is bad, mine is significantly better, and you should never post code if you don't know if it's going to work. |
In response to Jeff8500
|
|
Okay, so I remade my code. Popisfizzy's is still better and I'm not really trying to compete with it, but I'd like to know the flaws in this new one, if there are any. I ran it and it works completely fine. No apparent bugs, no lag.
mob [Edit: As well, I'm sorry Jeff I was frustrated earlier and it just seemed like a good time to say something to anybody. And thanks for helping me on the usr abuse and goto abuse. This code I posted is for informational purposes now, as I'd like to better my programming ability. And one way to learn is through mistakes.] |
1
2