Wow! First genetically proven scaleless ball python!!

From Esolang
Jump to navigation Jump to search

Wow! First genetically proven scaleless ball python!! is a Python derivative that doesn't have any sense of proper numbers (i.e "scaleless"), with three exceptions I shall get to in due time. The name and general idea was inspired by this post on the Scratch forums

Differences

  • You can't define an integer variable, otherwise it will give you "IntegerError: Attempted to define an integer". All other variable types are fair game, though so spam = "Hi!" will work but not eggs = 3.
  • You can compare stuff, as long as the "stuff" involved doesn't involve an integer or a list containing even one integer, otherwise it will give you "ComparisonError: Tried to compare integers"
  • Trying to bypass the no-integer rules by doing "one", "two" is also unallowed and will result in "BypassError".
  • Since WFgpsbp is not that mean, "dot notation" is allowed. However, you would have to rewrite your code to work with dot notation rather than the standard (unallowed in WFgpsbp) Arabic numerals as there's (obviously) no builtin to convert dot notation to arabic numerals. Dot numerals can be expressed using "< NUMBER OF DOTS HERE >" (this syntax doesn't work in regular Python)

Dot Notation

Dot notation (a concept unique to WFgpsbp due to it's lack of nessecity in regular Python) is a way of expressing numbers via how many dots (.) there are. For example, "...." in dot notation is 4 in numbers.

D-64 Compression

While the standard above works for small numbers like <....>, for larger numbers like 42069 there needs to be some kind of compression algorithm so that the code doesn't get unreasonably long. This is why I thought of D-64, which uses { NUMBER dots here } to replace manually typing in each and every dot. It's disabled by default, but you can enable it by adding ;D-64; to the top of the file!

(0 is represented by < > by the way. Negative numbers can't be represented easily, you need to do < > - < { THE NUMBER YOU WANT TO TURN NEGATIVE } >)

Exclusions

D-64 is the first exclusion to the "Arabic numerals aren't allowed" rule. The second is with printing ASCII characters (however, you still need to use either dot notation or D-64 for actually SETTING the ASCII characters), and the third is the index variable used in for loops (i.e - i). Technically, there is a 4th exception - numerals not used within the code itself; like strings or comments - although in theory it might be possible to apply the rule to those, it would seem really arbitrary and mean-spirited to the coder so those are allowed.

Example Programs

Hello, World!

Technically, print("Hello, World!") will work but that would be a boring example since it's basically the same as regular Python. Here's a significantly more interesting (and commented) program using dot numbers and ASCII (using D-64 compression)

;D-64;

START_OF_ASCII_PRINTABLE_BOUND = < { 33 dots here } > # 65 = !
END_OF_ASCII_PRINTABLE_BOUND = < { 126 dots here } > # 126 = ~
# The two variables above are purely there for debugging purposes
index = <.> # D-64 is not used here. It's a compression algorithm for large numbers, henceforth using it for one would ironically take up more bytes
string = []

# Begin setting up Hello World list
current_letter = < { 72 dots here } >
string.append(ord(current_letter))
current_letter = < { 102 dots here } >
string.append(ord(current_letter))
current_letter = < { 105 dots here } >
string.append(ord(current_letter))
string.append(ord(current_letter)) # Since there are two l's in "Hello, World!", we can get away with adding the same character to the list twice.
current_letter = < { 111 dots here } > # funni palindrome number
string.append(ord(current_letter))
current_letter = < { 44 dots here } > # another funni palindrome number
string.append(ord(current_letter))
current_letter = < { 32 dots here } >
string.append(ord(current_letter))
current_letter = < { 87 dots here } >
string.append(ord(current_letter))
current_letter = < { 111 dots here } > # funni palindrome number v2
string.append(ord(current_letter))
current_letter = < { 114 dots here } >
string.append(ord(current_letter))
current_letter = < { 108 dots here } >
string.append(ord(current_letter))
current_letter = < { 100 dots here } > # 100!
string.append(ord(current_letter))
current_letter = < { 33 dots here } >
string.append(ord(current_letter))

print("".join(chr(x) for x in string))

FizzBuzz

(NOTE: Based off the Python 3 program given in the article linked above

;D-64;

MIN_RANGE = <.>
MAX_RANGE = < { 101 dots here } >

for i in range(MIN_RANGE,MAX_RANGE):
	if i % <...> == 0:
		print("Fizz",end="")
	if i % <.....> == 0:
		print("Buzz",end="")
	if i % 3 and i % 5:
		print(i,end="")
	print()

99 Bottles Of Beer

NOTE: This program is based off this superb one by Gerold Penz. I rewrote it to fit Python 3's print syntax (WFgpsbp is based off Python 3 and not Python 2), but all this entailed was replacing mentions of print "String" with print("String") and adding F-strings where necessary.

;D-64;

quant = < { 99 dots here } >
MIN_RANGE = < >
MAX_RANGE = < { 99 dots here } >
COUNT_DOWN = < > - <.>

for quant in range(MAX_RANGE, MIN_RANGE, COUNTING DOWN):
   if quant > <.>:
      print(f"{quant} bottles of beer on the wall, {quant} bottles of beer."
      if quant > <..>:
         suffix = str(quant - <.>) + " bottles of beer on the wall."
      else:
         suffix = "1 bottle of beer on the wall."
   elif quant == <.>:
      print("1 bottle of beer on the wall, 1 bottle of beer.")
      suffix = "no more beer on the wall!"
   print(f"Take one down, pass it around, {suffix}")
   print("--")

Implementations

Similar story to one of my other esolangs, Colors in that I tried writing an interpreter but it was broken and I couldn't fix it.