Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Hacker Language by Tinus_Trotyl
class HackerLanguage:
def __init__(self):
self.message = ''
def write(self, addition):
self.message = self.message + addition
def delete(self,cut_off):
self.message = self.message[: -cut_off]
def send(self):
code = ''
for ch in self.message:
if ch == ' ': code += '1000000'
elif ch in '0123456789.,:!?$%@': code += ch
else: code += bin(ord(ch) + 0x80)[3:]
return code
def read(self, code):
message = ''
while code:
if code[:7] == '1000000': message, code = message + ' ', code[7:]
elif all(c in '01' for c in code[:7]): message, code = message + chr(int(code[:7], 2)), code[7:]
else: message, code = message + code[:1], code[1:]
return message
May 12, 2019
Comments: