Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias alph { if $1 isalpha { return $calc($asc($1) - 96) } | if $1 isnum { return $chr($calc($1 + 96)) } }
- alias a-path {
- ; $1 needs to be current position, and $2 needs to be target destination.
- var %a-curpos $1, %a-finalcount, %a-done
- if $1 && $2 && $1 != $2 {
- goto varsetting
- :varsetting
- ; number for the Letter Row for $1
- var %a-1 $alph($left(%a-curpos,1))
- ; number for the Letter Row for $2
- var %a-2 $alph($left($2,1))
- ; actual Number Row of $1
- var %a-3 $remove(%a-curpos,$left(%a-curpos,1))
- ; actual Number Row of $2
- var %a-4 $remove($2,$left($2,1))
- if %a-1 < %a-2 {
- var %a-direction-leftright right
- if %a-3 > %a-4 { var %a-direction-updown up }
- if %a-3 < %a-4 { var %a-direction-updown down }
- if %a-3 == %a-4 { var %a-direction-updown none }
- }
- if %a-1 > %a-2 {
- var %a-direction-leftright left
- if %a-3 > %a-4 { var %a-direction-updown up }
- if %a-3 < %a-4 { var %a-direction-updown down }
- if %a-3 == %a-4 { var %a-direction-updown none }
- }
- if %a-1 == %a-2 {
- var %a-direction-leftright none
- if %a-3 > %a-4 { var %a-direction-updown up }
- if %a-3 < %a-4 { var %a-direction-updown down }
- }
- ; Find sorrounding cells
- var %a-cell-above $+($left(%a-curpos,1),$calc($remove(%a-curpos,$left(%a-curpos,1)) - 1))
- var %a-cell-below $+($left(%a-curpos,1),$calc($remove(%a-curpos,$left(%a-curpos,1)) + 1))
- var %a-cell-left $alph($calc($alph($left(%a-curpos,1)) - 1))
- var %a-cell-right $alph($calc($alph($left(%a-curpos,1)) + 1))
- ; cell check - if not land or restricted (no obstacle)
- ; **** This is where I'm confused, how to determine which way to go ****
- if $EPirate.Cell.Restricted(%a-cell-above) == $false {
- if %a-direction-updown == up {
- ; Now the general direction is up and the cell above isnt restricted. I should move to this cell, but...
- ; what if the cell to the right is a shorter path and not restricted, and leftright direction variable is set to right,
- ; then which way should I go. Up or Right?
- ; how do I figure which way to go
- ; I may need to count the number of moves each way, but havent thought about this yet.
- }
- }
- ; put a 'goto varsetting' after I figure which is next cell to move to, to find next move.
- ; BUT set %a-curpos to the next cell before goto varsetting
- }
- ; Once completely done, unset variables
- :done
- unset %a-*
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement