summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-03-01 13:24:11 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-03-01 13:24:11 +0100 |
commit | 55c32019f5b82fd488c4ceed8c80e1b7a0fa114f (patch) | |
tree | b28565216098599b53b8cbe3619e51104c325e88 /src/struct/direction.erl | |
parent | 9b413bc5936994b66f3a1c693fbbfad0995c0b93 (diff) |
Cleaning up the handling of character turns.
Diffstat (limited to 'src/struct/direction.erl')
-rw-r--r-- | src/struct/direction.erl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/struct/direction.erl b/src/struct/direction.erl new file mode 100644 index 0000000..074cadf --- /dev/null +++ b/src/struct/direction.erl @@ -0,0 +1,36 @@ +-module(direction). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-type enum() :: ('up' | 'down' | 'left' | 'right'). + +-export_type([enum/0]). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + from_binary/1, + to_binary/1 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec from_binary (binary()) -> enum(). +from_binary (<<"U">>) -> up; +from_binary (<<"D">>) -> down; +from_binary (<<"L">>) -> left; +from_binary (<<"R">>) -> right. + +to_binary (up) -> <<"U">>; +to_binary (down) -> <<"D">>; +to_binary (left) -> <<"L">>; +to_binary (right) -> <<"R">>. |