[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
AI Challenge Forums • View topic - [C#] Contains() and Remove() not working correctly

It is currently Thu Jan 18, 2018 2:13 pm Advanced search

[C#] Contains() and Remove() not working correctly

Topics about starter packages, visualizer or any other third party tools.
Please submit new language requests in the Language Request Forum.

[C#] Contains() and Remove() not working correctly

Postby Jorisjuh » Tue Nov 08, 2011 3:03 pm

Jorisjuh
Lieutenant
 
Posts: 10
Joined: Tue Nov 08, 2011 2:36 pm

Re: [C#] Contains() and Remove() not working correctly

Postby Egg5 » Tue Nov 08, 2011 3:28 pm

Egg5
Cadet
 
Posts: 5
Joined: Wed Oct 26, 2011 8:07 am

Re: [C#] Contains() and Remove() not working correctly

Postby Jorisjuh » Tue Nov 08, 2011 5:07 pm

That's what I thought too, but I checked the hahses, they are identical.
Jorisjuh
Lieutenant
 
Posts: 10
Joined: Tue Nov 08, 2011 2:36 pm

Re: [C#] Contains() and Remove() not working correctly

Postby Jorisjuh » Tue Nov 08, 2011 6:13 pm

Jorisjuh
Lieutenant
 
Posts: 10
Joined: Tue Nov 08, 2011 2:36 pm

Re: [C#] Contains() and Remove() not working correctly

Postby gnu264 » Tue Nov 08, 2011 11:03 pm

gnu264
Captain
 
Posts: 23
Joined: Tue Nov 08, 2011 5:27 pm

Re: [C#] Contains() and Remove() not working correctly

Postby Jorisjuh » Tue Nov 08, 2011 11:34 pm

Jorisjuh
Lieutenant
 
Posts: 10
Joined: Tue Nov 08, 2011 2:36 pm

Re: [C#] Contains() and Remove() not working correctly

Postby gnu264 » Wed Nov 09, 2011 11:20 am

If I was you, I would only implement GetHashCode in the base class (i.e. Location) and not override it in derived classes. That way there can't be any calls to "wrong" GetHashCode() methods.

By the way, you are aware that your ants are recreated every turn? I.e. state.MyAnts contains new Ant instances every turn? Maybe that could interfere with your Dictionary too (although I don't think that's very likely)
gnu264
Captain
 
Posts: 23
Joined: Tue Nov 08, 2011 5:27 pm

Re: [C#] Contains() and Remove() not working correctly

Postby Jorisjuh » Wed Nov 09, 2011 12:24 pm

I only have 1 GetHashCode() method and it is in Location, so that can't be the problem.

I keep track of my list of ants. So the objects aren't recreted every turn.
Jorisjuh
Lieutenant
 
Posts: 10
Joined: Tue Nov 08, 2011 2:36 pm

Re: [C#] Contains() and Remove() not working correctly

Postby gnu264 » Wed Nov 09, 2011 3:51 pm

Well, I'm out of ideas... you might want to recreate the bug in a small test application and then ask for advice on StackOverflow.com.
gnu264
Captain
 
Posts: 23
Joined: Tue Nov 08, 2011 5:27 pm

Re: [C#] Contains() and Remove() not working correctly

Postby Jorisjuh » Wed Nov 09, 2011 3:55 pm

Okay, tnx for your help though!
Jorisjuh
Lieutenant
 
Posts: 10
Joined: Tue Nov 08, 2011 2:36 pm

Next

Return to Starter Packages & Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron