Reverse It v1.1.3

Introduction

This is a very simple Python script which basically creates a return path for directions given. You can use any separator which you choose. I tend to use a semi-colon because it's an easy separator and many sites out there give you dirs with that separator.

Downloading

You can download the source from www.zombii.org. It has been downloaded 42 times.

Installing

This script was written for Python which can be obtained from www.python.org. If you are using a Unix system you should make sure that you have Python installed in your PATH. This script should work on Windows but you're on your own there as to how you set that up.

Usage

$ ./reverse.py --help
usage: reverse.py [options]

options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s STRING, --separator=STRING
                        This is the separator used when you combine all of the
                        commands together to make a run. (default ';')
  -p STRING, --path=STRING
                        This is the path which is to be reversed. The commands
                        should be separated by either your supplied separator
                        or the deafult separator.

Example

$ ./reverse.py -s ';' -p '3 n;2 w;s;u'
d;n;2 e;3 s

TinyFugue Example

The following is a small macro which will let you pull the reverse paths directly from tf.

;;
;; Reverse path
;;
/def reverse_path = \
  /let _dirs=$[replace('"', '', replace('\'', '', {*}))]%; \
  /let _reverse=$(/quote -S /_echo !/path/to/reverse.py' -s ";" -p "%{_dirs}")%; \
  /_echo Reverse of %{_dirs} --> $(/escape ' %{_reverse})'

You can test out the new macro with the following:

/reverse_path 3 n;2 w;s;u
Reverse of 3 n;2 w;s;u --> d;n;2 e;3 s

Known Issues

This tool does not work with odd exits. It has the basic cardinal directions coded in, but after that, it will just leave a placeholder which you need to manually fill in.