Package: oceanscript
OceanScript Esoteric Language (2.3.0 release)OverviewOceanScript is an Esoteric language used to encode and decode text into
a formulation of characters - where the final result looks like waves in the ocean.Unlike its prior versions, OceanScript supports any character, as well as capitalization.
Your encoded string should be decoded to look exactly the same as the encoded string.How does it work?OceanScript isn't just random choice or a random jumble of characters. These characters
have very specific meanings, which once understood, can be used to write oceanscript
without the use of the encoder. Take a look at these 4 tables below:ㅤ<->ㅤ^abc.~def._ghi.ㅤ<->^jkl..~mno.._pqr..ㅤ<->ㅤ^stu...~vwx..._yz0...ㅤ<->ㅤ^123o~456o_789oㅤ<->ㅤWhen typing a character, you need to check the following in order:What row is my character in? (The rows are denoted by the following characters:^,~,_.)What column is my character in? (The columns are denoted by the following indicators:<,-,>.)What box is my character in? (The boxes are denoted by., multipled by n, where n is the box number. There are 4 boxes.)WarningAs of v2.3.0, BOX-4 characters (1-9) useoinstead of....for box denotion.
Please adjust to using this syntax as soon as possible.Our final product will be known as a "wave". It will contain from 3 to 6 characters.
Have a look at some examples below to understand how to write these waves.ExemplaraHere is an example of typing the charactera. It is the easiest character to type
from memory, and is great to use as a first example. Lets zoom in ona's box below:ㅤ<->ㅤ^abc.~def._ghi.ㅤ<->ㅤUsing the table above, the characterais in the top row of its box,
so our first character is^. Next, you need to check the column.ais
in the left-hand column, so our second character is<(pointing to the left).
Finally, we need to check which box characterais in. We will add.according to
the table above. The number of dots corresponds to the box number (1-4).ain oceanscript is^<..ExemplarxHere is an example of typing the characterx. Lets zoom in onx's box below:ㅤ<->ㅤ^stu...~vwx..._yz0...ㅤ<->ㅤUsing the table above, the characterxis in the second row of its box,
so our first character is~. Next, you need to check the column.xis
in the right-hand column, so our second character is>(pointing to the right).
Finally, we need to check which box characterxis in. We will add..., because
this is box 3 of 4.xin oceanscript is~>....Joining wavesWave is the name used for a single encoded character (z->_-...). Waves can be freely
joined together. Remember that every character ends with., so you can easily work out where
each wave ends.hello->_-.~-.^>..^>..~>..foobar->~>.~>..~>..^-.^<._>..Joining tidesTide is the name used for a collection of "waves", so essentially a word converted
into oceanscript. For example,_-.~-.^>..^>..~>..is a tide, meaning "hello".
Tides can be joined using either commas, or line breaks. For pretty formatting, or if
you have a lot of text, you should use line breaks - but otherwise go with commas.hello foobar->_-.~-.^>..^>..~>..,~>.~>..~>..^-.^<._>..(notice the comma separating these two waves)OR...hello foobar->_-.~-.^>..^>..~>..~>.~>..~>..^-.^<._>..Special charactersDon't fear, oceanscript isn't just limited to a-z and 0-9. Well, it used to be - but a
new special character indicator has been added to support any other character.It is best to keep these special characters out of the ocean, so these characters will
need to use a raft (=). Simply put the raft before the character. If you wanted to write the
Greek lambda character (λ), it will need a raft seeing as it's not in the large table,
so it would simply be written as=λ. More common characters (.,!,?) are more likely
to appear, they will need rafts too.?->=?^->=^...->=.=.=.Despite not appearing in the table, capitalized a-z charactersDO NOTneed to use rafts.
See below about capitalization.CapitalizationCapitalization hadn't been supported for months proceeding the initial release
of oceanscript, but it's now available. To make a character capital, use a splash (*) before the wave.a->^<.A->*^<.For each capital wave you have, you will have to add a splash before each one.Yes, these waves are choppy...hello->_-.~-.^>..^>..~>..HELLO->*_-.*~-.*^>..*^>..*~>..Note that you should not use splashes for numeric characters, or any characters that are not alphabetic.
This is because these characters do not have case forms (and therefore don't produce splashes!You could call them subtle waves...)Line breaksFor line breaks in oceanscript, use%. For example, presenting an acronym:N
A
S
AIn oceanscript, the above acronym would be encoded into*~-..%*^<.%*^<...%*^<..All identifiersIdentifierDescription,Represents a space.\nRepresents a space.%Represents a line break.=Creates a raft for a single character (proceeding character will be ignored by encoder).*Creates a splash for a wave (proceeding wave will be capitalized).^Denotes the top row of a box for a single wave.~Denotes the middle row of a box for a single wave._Denotes the bottom row of a box for a single wave.<Denotes the left-handed column of a box for a single wave.-Denotes the central column of a box for a single wave.>Denotes the right-handed column of a box for a single wave..Denotes the box number based on the count of ".".Terminology glossaryWordDescriptionExampleraftA character (=) used to prefix a special character (not a-Z or 0-9).=.rippleA character that would make up a wave. Does not include=,*or%.^splashA character (*) used to capitalize the following wave.*_<.tideA collection of waves to form a word, where the word is the tide.*_-.~-.^>..^>..~>..waveA single character encoded into oceanscript.^<..Python ImplementationI just had to make a Python library for this. It was all just a looming thought
in my mind with so much potential. It's been great to be able to create a working
usable program for it, for anyone to use and play around with.Start by importing the module:importoceanscriptEncoding into oceanscriptUse theoceanscript.encodemethod. This method also takes an optional
keyword-only argument "mode", which decides whether the encoder uses commas
or line breaks to replace spaces. Specifystretchfor line breaks, orsquashfor commas. Defaults tosquash.>>>oceanscript.encode("hello")'_-.~-.^>..^>..~>..'>>>oceanscript.encode("Hello world!")'*_-.~-.^>..^>..~>..,~-...~>.._>..^>..~<.=!'>>>oceanscript.encode("Hello world!",mode="stretch")'*_-.~-.^>..^>..~>..''~-...~>.._>..^>..~<.=!'Decoding from oceanscriptUse theoceanscript.decodemethod. Both modes from the encode method are
compatible with decoding (you don't have to specify a mode here).>>>oceanscript.decode("_-.~-.^>..^>..~>..")'hello'>>>oceanscript.decode("*_-.~-.^>..^>..~>..,~-...~>.._>..^>..~<.=!")'Hello world!'>>>text="""*_-.~-.^>..^>..~>..~-...~>.._>..^>..~<.=!""">>>oceanscript.decode(text)'Hello world!'If the oceanscript doesn't look quite right, the parser won't like it.oceanscript.OceanScriptErroris thrown, but the traceback details are fairly useful
for correcting these mistakes.OceanScriptError has apositionattribute, which is the string index in where the
exception was raised (at the start of the wave affected).>>>oceanscript.decode("*^>o")# trying to capitalize integer (3)OceanScriptError:[Position0]Splashindicatornotallowedforintegerwaves>>>oceanscript.decode("=a")# rafting a-Z/0-9OceanScriptError:[Position0]Donotusea-Z/0-9onaraft('=a').Use'^<.'instead.>>>oceanscript.decode("^-.~>..#>..")# invalid row indicator '#'OceanScriptError:[Position7]Invalidsyntax:'#'.Perhapsyoumeant'=#'?>>>oceanscript.decode("*^-..._>._-.^<...,_>.^<...,~-..._>..~>..~-.._+.")# invalid column indicator '+'OceanScriptError:[Position44]Rowindicator'_'expectingvalidcolumnindicatorafterwards('<','-',or'>')>>>oceanscript.encode("*~<.~-.^>..^-...^<.=:,*=Δ")# splash indicator before already capitalized alphabetic characterOceanScriptError:[Position22]Splashisredundentinthisposition,givenwaveisalreadyuppercase('Δ').Use'*=δ'or'=Δ'instead.Other tracebacks can appear, too.You can handle tracebacks to your own liking with the.without_position_reference()method
to remove the position reference prefixed to the start of the exception string.>>>try:...oceanscript.decode("*~>.._<.~>..~-..~-.^-..,*~>..=:,*=Ǫ")...exceptOceanScriptErroraserr:...print(err.without_position_reference())"Splash is redundent in this position, given wave is already uppercase ('Ǫ'). Use '*=ǫ' or '=Ǫ' instead."Splitting WavesSincev2.1.0, the functionality to split waves has been created as
a public method, and is continually used by the decoder when decoding.
It has aninclude_invalidkeyword only argument which defines whether
to include invalid identifiers/waves in the string, defaulting to True.>>>oceanscript.splitwaves("*_-.~-.^>..^>..~>..,~-...~>.._>..^>..~<.=!")('*_-.','~-.','^>..','^>..','~>..',',','~-...','~>..','_>..','^>..','~<.','=!')>>>oceanscript.splitwaves("*_-.~-.^>..^>..~>..,~-...~>.._>..^>..~<.=!,bad")('*_-.','~-.','^>..','^>..','~>..',',','~-...','~>..','_>..','^>..','~<.','=!',',','b','a','d')>>>oceanscript.splitwaves("*_-.~-.^>..^>..~>..,~-...~>.._>..^>..~<.=!,bad",include_invalid=False)('*_-.','~-.','^>..','^>..','~>..',',','~-...','~>..','_>..','^>..','~<.','=!',',')Please see thedocsfor more information.InstallationInstall from the recommended package installer,pip.pipinstalloceanscriptLicenseLicensed under MIT.