fb:porticula NoPaste
Pathfinder FB uebersetzung (unvollstaendig)
Uploader: | Eternal_Pain |
Datum/Zeit: | 22.07.2007 07:43:41 |
dim show as integer
dim max as integer
dim lod as integer
show=1 ' sichtbar oder nicht?
max=40
lod=0
'If lod=1
' max=0
' open "data.txt" for output as #1
' While Not Eof(x)
' c$=ReadLine$(x)
' max=max+1
' Wend
' Close #1
'EndIf
Dim dat(max,max) as integer
Dim knot(max*(max+1)+max) as integer
Dim knot_urspr(max*(max+1)+max) as integer
Dim knot_dist(max*(max+1)+max) as integer
Dim ToDo(max*(max+1)+max) as integer
Dim used(max*(max+1)+max) as integer
Dim tnum as integer
Dim num as integer
Dim posx as Integer
Dim posy as Integer
Dim starx as integer
dim stary as integer
dim tarx as integer
dim tary as integer
dim found as integer
dim chx as integer
dim chy as integer
dim px as integer
dim py as integer
dim pnum as integer
dim searchdist as integer
dim searchx as integer
dim searchy as integer
dim tposx as integer
dim tposy as integer
dim tx as integer
dim ty as integer
Screenres (max+20)*8,max*16,32
'SetBuffer BackBuffer()
Restore datas
For y as integer=1 To max
For x as integer=1 To max
Read dat(x,y)
tnum=x*(max+1)+y
If dat(x,y)=2 then
num=(x*(max+1))+y
knot(num)=1
ToDo(num)=1
posx=x
posy=y
starx=x
stary=y
EndIf
If dat(x,y)=3 then
tarx=x
tary=y
EndIf
locate y,x:?chr(dat(x,y)+32)
Next
Next
sleep
If tarx=0 Or tary=0 Then Print "Kein Ziel!":sleep:end
'knot_dist(num)=cdist(num/(max+1),num And max,tarx,tary)
While Not Multikey(&h01) Or found=1
'Cls
num=posx*(max+1)+posy
For chx=-1 To 1
For chy=-1 To 1
px=posx+chx
py=posy+chy
pnum=px*(max+1)+py
If px>0 And py>0 And px<=max And py<=max And Abs(chx)<>Abs(chy) then
If dat(px,py)<>1 then
If used(pnum)=0 then
knot(pnum)=1
ToDo(pnum)=1
knot_urspr(pnum)=num
knot_dist(pnum)=knot_dist(num)+1
If dat(px,py)=6 Then knot_dist(pnum)=knot_dist(pnum)+.5
If dat(px,py)=7 Then knot_dist(pnum)=knot_dist(pnum)+.8
EndIf
EndIf
EndIf
Next
Next
ToDo(num)=0
used(num)=1
searchdist=10000
searchx=0
searchy=0
For x as integer=1 To max
For y as integer=1 To max
num=x*(max+1)+y
If ToDo(num)=1 then
If knot_dist(num)<searchdist then
searchx=x
searchy=y
searchdist=knot_dist(num)
EndIf
EndIf
Next
Next
If searchx=0 Or searchy=0 Then Print "Kein Weg!":sleep:end
posx=searchx
posy=searchy
dat(posx,posy)=4
If show=1 then
For x as integer=1 To max
For y as integer=1 To max
tposx=(x)'*20
tposy=(y)'*20
If dat(x,y)=0 Then Color rgb(125,125,125)
If dat(x,y)=1 Then Color rgb(255,0,0)
If dat(x,y)=2 Then Color rgb(0,255,0)
If dat(x,y)=3 Then Color rgb(0,0,255)
If dat(x,y)=4 Then Color rgb(255,0,255)
If dat(x,y)=6 Then Color rgb(125,125,255)
If dat(x,y)=7 Then Color rgb(128,0,0)
'Rect tposx,tposy,20,20
Color rgb(255,255,255)
locate tposx,tposy
Print Int(knot_dist(x*(max+1)+y))
Next
Next
EndIf
locate 1,max*20
Print "X: " &posx &" Y:" &posy &" " &knot_urspr(posx*(max+1)+posy)
If Abs(tarx-posx)<=1 And Abs(tary-posy)<=1 And Abs(tarx-posx)<>Abs(tary-posy) then
tx=posx
ty=posy
dat(tx,ty)=5
tnum=knot_urspr((tx*(max+1))+ty)
tx=tnum/(max+1) - (tnum/(max+1)) Mod 1
ty=((tnum/(max+1.)) - tx) * (max+1)
dat(tx,ty)=5
While tnum<>(starx*(max+1)+stary)
tnum=knot_urspr(tnum)
tx=tnum/(max+1) - (tnum/(max+1)) Mod 1
ty=((tnum/(max+1.)) - tx) * (max+1)
dat(tx,ty)=5
'Screenlock
'Cls
locate 1,1
Print tnum &" " &tx &" " &ty
'Screenunlock
'sleep
Wend
For x as integer=1 To max
For y as integer=1 To max
tposx=(x)'*20
tposy=(y)'*20
If dat(x,y)=0 Then Color rgb(125,125,125)
If dat(x,y)=1 Then Color rgb(255,0,0)
If dat(x,y)=2 Then Color rgb(0,255,0)
If dat(x,y)=3 Then Color rgb(0,0,255)
If dat(x,y)=4 Then Color rgb(255,0,255)
If dat(x,y)=5 Then Color rgb(255,255,255)
If dat(x,y)=6 Then Color rgb(125,125,255)
If dat(x,y)=7 Then Color rgb(128,0,0)
'Rect tposx,tposy,20,20
Color rgb(255,255,255)
If dat(x,y)=5 Then Color rgb(0,0,0)
locate tposx,tposy
Print Int(knot_dist(x*(max+1)+y))
Next
Next
'Flip
Print "Gefunden! X:" &posx &" Y:" &posy
EndIf
'If show=1 Then Flip:Delay 0
Wend
End
datas:
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,0
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,7,7,7,1,1,1,0,0,1,0,1,1,1,1,0,1,1,1,1,1,1,0
Data 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,7,1,1,1,0,0,0,0,1,1,0,0,0,1,7,7,7,7,7,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,7,1,0,0,0,0,1,1,1,1,0,1,1,1,7,7,1,1,1,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,7,1,0,1,1,1,1,1,0,0,0,1,1,7,7,7,1,1,1,0
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,7,1,0,0,1,0,1,1,0,1,1,1,1,7,7,7,1,6,6,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,7,1,1,0,1,0,1,1,0,0,0,1,1,7,7,7,1,6,1,0
Data 0,1,1,1,1,1,1,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7,1,6,6,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,7,1,1,0,1,0,1,1,0,0,0,1,1,7,7,7,1,1,1,0
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,7,1,0,0,1,0,1,1,1,1,0,1,1,7,7,7,1,7,7,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,7,1,0,1,1,0,1,1,0,0,0,1,1,7,7,7,1,7,1,0
Data 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,7,1,0,0,1,0,1,1,0,1,1,1,1,7,7,7,1,7,7,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,7,1,1,0,1,0,1,1,0,0,0,1,1,7,7,7,1,1,1,0
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Function cdist(byval x as integer, byval y as integer, byval tax as integer, byval tay as integer) as integer
Return Sqr((x-tax)*(x-tax)+(y-tay)*(y-tay))
End Function