Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
ewoke wrote:ninjasupeatsninja wrote:ewoke wrote:7 posts after eachother wow,
capasha wrote:
"The professionals can use this if their too lazy to be re-coding bots (like me),"
I would build a new one from the beginning instead of using yours. Yours have some things that isn't even needed.
Like what (besides arrays that i could be using <list>s)?depends on the bot of course
Well... Arrays are just as good, right? Plus it does have the function PlayerIdOf("player name") (as an int)... i don't see any reason not to use arrays.
sure but you could use if (list.Contains("name")) without even writing a function for it
Well... I don't mind writing a function once whatsoever. Eh, whats the point of rewriting the code anyways?
As stated before: because you currently use an unnecessary amount of ram and even though the array is reliable, it's not 100% bug proof, since it's limited.
I don't mean to be harsh, but if you'd write this for your work, you'd be fired.
But really, what you made is good and it's helpful that you shared it, so don't let this demotivate you or anything.
Offline
I didn't mean to be rude or mean or anything. I'm just saying that it might be easier for beginners to learn the "normal" way before trying something new.
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
public struct Player{public int ID; public string Name;/* More props can be added, too. */}
public Dictionary<int, Player> Players = new Dictionary<int, Player>();
// Add to the dictionary on case add - Can use a static void inside of the Player in case it was a class for easier management. -
// Usage.
Console.WriteLine("Player - {0} - {1}", Players[e.GetInt(0)].Name, Players[e.GetInt(0)].ID.ToString());
Offline
public struct Player{public int ID; public string Name;/* More props can be added, too. */} public Dictionary<int, Player> Players = new Dictionary<int, Player>(); // Add to the dictionary on case add - Can use a static void inside of the Player in case it was a class for easier management. - // Usage. Console.WriteLine("Player - {0} - {1}", Players[e.GetInt(0)].Name, Players[e.GetInt(0)].ID.ToString());
<int,player> while player also contains a integer, this is unnecessary, could have used a list<Player> or a array Player[]
if you can read this....good for you
Offline
DarkDragon4900 wrote:public struct Player{public int ID; public string Name;/* More props can be added, too. */} public Dictionary<int, Player> Players = new Dictionary<int, Player>(); // Add to the dictionary on case add - Can use a static void inside of the Player in case it was a class for easier management. - // Usage. Console.WriteLine("Player - {0} - {1}", Players[e.GetInt(0)].Name, Players[e.GetInt(0)].ID.ToString());
<int,player> while player also contains a integer, this is unnecessary, could have used a list<Player> or a array Player[]
A discussion we just had was (in my opinion) is that a list (or dictionary/map/etc.) is better than an array since it doesn't have a fixed size and reduces ram usage while taking up barely anything of your performance.
Offline
but you can dynamically program a array, when its almost full extend size etc etc
if you can read this....good for you
Offline
but you can dynamically program a array, when its almost full extend size etc etc
And that's exactly how a List work, but then with a couple extra functions... So safe yourself some time and just use a List...
Offline
ewoke wrote:but you can dynamically program a array, when its almost full extend size etc etc
And that's exactly how a List work, but then with a couple extra functions... So safe yourself some time and just use a List...
yup, for beginner programmers a list is way easier
if you can read this....good for you
Offline
den3107 wrote:ewoke wrote:but you can dynamically program a array, when its almost full extend size etc etc
And that's exactly how a List work, but then with a couple extra functions... So safe yourself some time and just use a List...
yup, for beginner programmers a list is way easier
For professionals too.
What I always get taught: Use the tools given too you. Make sure you work quick, but don't let the quality drop.
Meaning: All functionality you just talked about is already there: List.
List is faster to use than to recreate the entire List object.
List is just as good as what you want to make.
List = faster
List = same quality
List = best
Besides, you usually learn how to use a List rather late, in my opinion.
Offline
DarkDragon4900 wrote:▼Hidden text<int,player> while player also contains a integer, this is unnecessary, could have used a list<Player> or a array Player[]
It's easier to use Players[e.GetInt(0)] than it is to use a loop/foreach and find which player is the player we need.
And giving the player struct an ID makes it easier to get the ID.
Offline
ewoke wrote:DarkDragon4900 wrote:▼Hidden text<int,player> while player also contains a integer, this is unnecessary, could have used a list<Player> or a array Player[]
It's easier to use Players[e.GetInt(0)] than it is to use a loop/foreach and find which player is the player we need.
And giving the player struct an ID makes it easier to get the ID.
no need to loop through a list, it has a Contains method
if you can read this....good for you
Offline
DarkDragon4900 wrote:ewoke wrote:DarkDragon4900 wrote:▼Hidden text<int,player> while player also contains a integer, this is unnecessary, could have used a list<Player> or a array Player[]
It's easier to use Players[e.GetInt(0)] than it is to use a loop/foreach and find which player is the player we need.
And giving the player struct an ID makes it easier to get the ID.no need to loop through a list, it has a Contains method
Contains only returns a boolean, I think you mean .Find().
For .Find() you'd need to recreate the entire Player object though, so I think the int dictionary method thingy is fine if you don't want to make a search method.
Offline
▼Hidden textno need to loop through a list, it has a Contains method
Contains is a bool which returns whether or not the List has the player you want, but how would you get the player you want unless you loop through it?
It seems den sent a reply before I sent mine. :p
Offline
ewoke wrote:▼Hidden textno need to loop through a list, it has a Contains method
Contains is a bool which returns whether or not the List has the player you want, but how would you get the player you want unless you loop through it?
It seems den sent a reply before I sent mine.
Mwuhaha!
But I think it's best to just use a List and create a custom method that loops through it and finds the desired Player object.
Offline
ninjasupeatsninja wrote:ewoke wrote:ninjasupeatsninja wrote:ewoke wrote:7 posts after eachother wow,
capasha wrote:
"The professionals can use this if their too lazy to be re-coding bots (like me),"
I would build a new one from the beginning instead of using yours. Yours have some things that isn't even needed.
Like what (besides arrays that i could be using <list>s)?depends on the bot of course
Well... Arrays are just as good, right? Plus it does have the function PlayerIdOf("player name") (as an int)... i don't see any reason not to use arrays.
sure but you could use if (list.Contains("name")) without even writing a function for it
Well... I don't mind writing a function once whatsoever. Eh, whats the point of rewriting the code anyways?
As stated before: because you currently use an unnecessary amount of ram and even though the array is reliable, it's not 100% bug proof, since it's limited.
I don't mean to be harsh, but if you'd write this for your work, you'd be fired.But really, what you made is good and it's helpful that you shared it, so don't let this demotivate you or anything.
Eh, I'm used to getting made fun of. (not saying i am)
And, I am not even the age to apply for a job.
the RAM usage can be slowed down, by minimizing the array...
And the list[] thing doesn't contain the user's id.
so that is why...
players[m.GetInt(0)] = 20;
wins[m.GetInt(0)] = 0;
Offline
I didn't mean to be rude or mean or anything. I'm just saying that it might be easier for beginners to learn the "normal" way before trying something new.
Eh, they really should.
Offline
▼Hidden textEh, I'm used to getting made fun of.
And, I am not even the age to apply for a job.
the RAM usage can be slowed down, by minimizing the array...
And the list[] thing doesn't contain the user's id.
so that is why...
players[m.GetInt(0)] = 20;
wins[m.GetInt(0)] = 0;
I'm not the age nor have the credentials to apply for in I(C)T job either, so we're on the same level there.
And again, we're not making fun of you, we're trying to teach you something, even though we say it a bit harsh.
You can get an item at a certain position through List.getItemAt(int pos);
Though if you wish to let pos refer to the player's id you'd have to use either a dictionary (Dictionary<int, Player>) or write a method that loops through your array or list and searches for the Player object that holds the requested id.
Offline
Offline
[ Started around 1732806317.3428 - Generated in 0.125 seconds, 13 queries executed - Memory usage: 1.76 MiB (Peak: 2.01 MiB) ]