🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.tcl
Article #137

Re: Temat akademicki

#137
From: Wojciech Kocjan
Date: Tue, 19 Jul 2005 08:21
34 lines
1978 bytes
Wojciech Kocjan napisał(a):

 > Właśnie się koduje w C. Nie szuka optymalnej, ale w miare dobrą i 
robi to szybko. Tylko jest minus - to trwa ok 1 sekundy na planszy 
200x100 (0,0 do 199,99). Aha i nie przewiduje, ze planety sa okragle i 
mozna przesmigac z prawej strony do lewej - ale i do tego dojdę.


Ok.

Kod właśnie przeszedł dużą (przedtem wysłałem po drobnej, ale teraz to 
już power!) optymalizację. Analizuje 500x500 w 0,2s (na P4 2,8GHz). 
Natomiast 200x200 już w 0,04s.

www.zoro2.org/_chwilowe/shortestpath.c

To jeszcze i tak mozna mocno zoptymalizowac (szybkosc kosztem 
czytelnosci), ale nie chce mi sie.

Wystarczy skompilowac i smiga.

set map [list \
     [list 1 2 3 4 5 6 7] \
     [list 4 3 2 1 3 2 1] \
     [list 2 3 1 4 5 3 2] \
     [list 4 5 6 3 2 7 1] \
     ]

set path [shortestpath::shortestpath $map 0 0 6 3]

foreach {x y} $path {puts "Krok: $x, y"}

-- 
WK
Technical Details
Message-ID: <dbid5r$5d5$2@atlantis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <dbddek$9qb$1@atlantis.news.tpi.pl> <dbej9d$4u9$1@atlantis.news.tpi.pl> <dbfhlf$qr6$1@atlantis.news.tpi.pl> <dbh1bq$md1$1@atlantis.news.tpi.pl> <dbi6nb$heo$1@atlantis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Wojciech Kocjan <mojeimie@kocjan.org>
Newsgroups: pl.comp.lang.tcl
Subject: Re: Temat akademicki
Date: Tue, 19 Jul 2005 10:21:15 +0200
Organization: tp.internet - http://www.tpi.pl/
Lines: 34
Message-ID: <dbid5r$5d5$2@atlantis.news.tpi.pl>
References: <dbddek$9qb$1@atlantis.news.tpi.pl> <dbej9d$4u9$1@atlantis.news.tpi.pl> <dbfhlf$qr6$1@atlantis.news.tpi.pl> <dbh1bq$md1$1@atlantis.news.tpi.pl> <dbi6nb$heo$1@atlantis.news.tpi.pl>
NNTP-Posting-Host: dq2.dataquest.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1121761276 5541 195.116.54.236 (19 Jul 2005 08:21:16 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Tue, 19 Jul 2005 08:21:16 +0000 (UTC)
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: pl, en-us, en
In-Reply-To: <dbi6nb$heo$1@atlantis.news.tpi.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit