Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Hacker Language by mozurin
import re
class HackerLanguage:
def __init__(self):
self.buffer = []
def write(self, text):
self.buffer.extend(text)
def delete(self, length):
self.buffer = self.buffer[:-length]
def send(self):
return ''.join(
bin(ord(c))[2:] if c.isalpha() else c for c in self.buffer
).replace(' ', '1000000')
def read(self, coded):
return re.sub(
r'[01]{7}',
lambda e: chr(int(e[0], 2)) if e[0] != '1000000' else ' ',
coded
)
July 4, 2018