[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
AI Challenge Forums • View topic - Bot timeout- programming in Python 2.7

It is currently Mon Jul 16, 2018 4:05 pm Advanced search

Bot timeout- programming in Python 2.7

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

Bot timeout- programming in Python 2.7

Postby asa88 » Wed Nov 16, 2011 10:05 pm

I am running into an issue with bot timing out in middle of the game like it usually times around 19th -25th turn , it started happening when i changed the code to implement a pathfinding alg in the direction function in ants.py , it works with the default code.This is local . when i submit it to the server it says "Test Error: compiled, but failed test cases"

Do you have any ideas why it is timing out ? is it because i take a lot of time or something computing my move ?? :?
asa88
Cadet
 
Posts: 2
Joined: Wed Nov 16, 2011 9:58 pm

Re: Bot timeout- programming in Python 2.7

Postby mac » Thu Nov 17, 2011 12:32 am

mac
Brigadier-General
 
Posts: 151
Joined: Mon Oct 31, 2011 6:39 am

Re: Bot timeout- programming in Python 2.7

Postby asa88 » Thu Nov 17, 2011 8:16 am

Thanks man it certainly helps i guess the time taken by bot after each turn increases to make a decision. Certain need of some optimization!!!
asa88
Cadet
 
Posts: 2
Joined: Wed Nov 16, 2011 9:58 pm

Re: Bot timeout- programming in Python 2.7

Postby heartcore1970 » Thu Nov 17, 2011 9:37 am

This may be obvious if you are an experienced Python programmer but I had very bad timeouts in my bot. Even one diffusion calculation proved to heavy. Well I have been developing mainly for the web with Python and never really grasped the different data types and the difference in their cost.

In my bot, I was using a lot of lists:

all_tiles = []
seen_tiles = []
visited = []

And I would use lot's of lookups in these lists.

Long story short

I replaced lists for set wherever possible and have yet to see my first timeout, even with 8 diffusion calculation rounds on the entire map.

Hope this helps.
heartcore1970
Cadet
 
Posts: 6
Joined: Sun Nov 13, 2011 7:11 pm

Re: Bot timeout- programming in Python 2.7

Postby Janzert » Fri Nov 18, 2011 8:56 am

In python time.time() always measures wall clock time, time.clock() is the same under windows but under *nix like systems it measures cpu time. The starter bots were corrected to use time.time() a little while back.
Janzert
Contest Organizer
 
Posts: 271
Joined: Sun Feb 07, 2010 1:59 am

Re: Bot timeout- programming in Python 2.7

Postby BenJackson » Fri Nov 18, 2011 5:22 pm

BenJackson
Colonel
 
Posts: 94
Joined: Sat Oct 29, 2011 4:16 am


Return to Starter Packages & Tools

Who is online

Users browsing this forum: No registered users and 2 guests

cron