Official Everybody Edits Forums

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.

#26 2015-04-28 23:45:07

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

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.

Offline

#27 2015-04-29 00:54:20

Xfrogman43
Member
From: need to find a new home
Joined: 2015-02-15
Posts: 4,174

Re: [Code] Starting off a bot.

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.


zsbu6Xm.png thanks zoey aaaaaaaaaaaand thanks latif for the avatar

Offline

#28 2015-04-29 11:31:37

DarkDragon4900
Member
Joined: 2015-03-17
Posts: 251

Re: [Code] Starting off a bot.

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

#29 2015-04-29 13:19:26

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [Code] Starting off a bot.

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[]


if you can read this....good for you

Offline

#30 2015-04-29 13:25:28

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

ewoke wrote:
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

#31 2015-04-29 13:27:40, last edited by ewoke (2015-04-29 13:28:04)

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [Code] Starting off a bot.

but you can dynamically program a array, when its almost full extend size etc etc


if you can read this....good for you

Offline

#32 2015-04-29 13:29:28, last edited by den3107 (2015-04-29 13:29:41)

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

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...

Offline

#33 2015-04-29 13:31:01

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [Code] Starting off a bot.

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


if you can read this....good for you

Offline

#34 2015-04-29 13:39:48, last edited by den3107 (2015-04-29 13:40:30)

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

ewoke wrote:
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

#35 2015-04-29 14:52:11

DarkDragon4900
Member
Joined: 2015-03-17
Posts: 251

Re: [Code] Starting off a bot.

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.

Offline

#36 2015-04-29 15:10:05

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [Code] Starting off a bot.

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


if you can read this....good for you

Offline

#37 2015-04-29 15:20:54

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

ewoke wrote:
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

#38 2015-04-29 15:29:43, last edited by DarkDragon4900 (2015-04-29 15:29:56)

DarkDragon4900
Member
Joined: 2015-03-17
Posts: 251

Re: [Code] Starting off a bot.

ewoke wrote:
Hidden text

no 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

#39 2015-04-29 15:59:12

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

DarkDragon4900 wrote:
ewoke wrote:
Hidden text

no 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. //forums.everybodyedits.com/img/smilies/tongue

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

#40 2015-04-30 00:56:03, last edited by SirJosh3917 (2015-04-30 20:56:37)

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: [Code] Starting off a bot.

den3107 wrote:
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

#41 2015-04-30 00:56:50

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: [Code] Starting off a bot.

Xfrogman43 wrote:

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

#42 2015-04-30 09:35:02, last edited by den3107 (2015-04-30 09:36:30)

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Code] Starting off a bot.

ninjasupeatsninja wrote:
Hidden text

Eh, 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

#43 2015-04-30 09:40:31

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Re: [Code] Starting off a bot.

Yes, tbh, ur code is messy.
use a player class or struct
then make a dictionary where the key is the user id with the value of player

Then you are able to add whatever u like to the player class/ struct (eg) Crown, Coins, Wins, Pos)
Better expose urself to more data types


Ug3JzgO.png

Offline

goeyfun1430383231500061

Board footer

Powered by FluxBB

[ Started around 1732805912.1604 - Generated in 0.121 seconds, 12 queries executed - Memory usage: 1.76 MiB (Peak: 2.01 MiB) ]