diff --git a/README.md b/README.md index 4ce476c..e55f933 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PyWTF `a-z()+` -PyWTF is an esoteric and educational programming style based on JSFuck and inspired by [this tweet](https://x.com/chordbug/status/1834642829919781369). It uses only built-in functions to execute code. +PyWTF is an esoteric and educational programming style based on JSFuck and inspired by [this tweet](https://x.com/chordbug/status/1834642829919781369). It uses only built-in functions to execute code. **It currently represents all characters below `0x7f` in 49 characters or less.** It does not depend on a browser, so you can even run it with Python (to come). @@ -13,11 +13,10 @@ By [@sealldev](https://twitter.com/sealldev) and [friends](https://github.com/se The following source will do an `print(1)`: ```python -exec(chr(ord(str(int(not())+int(not())))+ord(next(reversed(str(object())))))+ -next(iter(str(range(not()))))+chr(ord(str(int()))+ord(next(reversed(hex(ord( -max(str(bytearray()))))))))+chr(int(str(int(not()))+str(int(not()))+str(int() -)))+max(str(set()))+min(str(set()))+str(int(not()))+next(reversed(str(range( -not()))))) +exec(chr(ord(max(oct(int())))+(not()))+max(str(range( +int())))+chr(sum(range(len(repr(str(set))))))+chr(max( +range(ord(max(oct(int()))))))+max(str(set))+min(str(set() +))+str(+(not()))+max(str(tuple()))) ``` ### Basics diff --git a/index.html b/index.html index dd8effc..d1091b6 100644 --- a/index.html +++ b/index.html @@ -1,80 +1,20 @@ PyWTF - Write any Python with only built-in functions. - + - + + +

PyWTF

()+
a-z

-

PyWTF is an esoteric and educational programming style based on JSFuck and inspired by this tweet. It uses only built-in functions to execute code.

+

PyWTF is an esoteric and educational programming style based on JSFuck and inspired by this tweet. It uses only built-in functions to execute code. It currently represents all characters below 0x7f in 49 characters or less.

It does not depend on a browser, so you can run it with Python.

@@ -86,9 +26,14 @@

()+
a-z

+
+ + +
+
- +
@@ -98,13 +43,13 @@

()+
a-z

- +
- - + +
- Run This +

Links

@@ -136,17 +81,20 @@

Basics

diff --git a/pywtf.js b/pywtf.js index 6816612..5deed22 100644 --- a/pywtf.js +++ b/pywtf.js @@ -4,133 +4,131 @@ function $(id){ const csvData = `0,chr(int()) 1,chr(not()) -2,chr(len(str(dict()))) +2,chr((not())+(not())) 3,chr(len(hex(int()))) 4,chr(len(str(not()))) 5,chr(len(str(set()))) -6,chr(len(str(complex(not())))) +6,chr(len(str(set()))+(not())) 7,chr(len(repr(str(set())))) 8,chr(len(bin(ord(str(int()))))) 9,chr(len(repr(repr(chr(int()))))) 10,min(str(credits)) 11,chr(len(str(range(int())))) 12,chr(len(set(str(type(bytes()))))) -13,chr(len(str(type(int())))) -14,chr(len(str(type(not())))) -15,chr(len(str(type(float())))) -16,chr(len(str(type(object())))) -17,chr(len(str(type(complex())))) -18,chr(len(str(type(reversed(str()))))) -19,chr(len(repr(str(type(complex()))))) +13,chr(len(str(set))) +14,chr(len(str(dict))) +15,chr(len(str(bytes))) +16,chr(len(str(object))) +17,chr(len(str(complex))) +18,chr(len(str(reversed))) +19,chr(len(str(reversed))+(not())) 20,chr(len(str(set(str(not()))))) -21,chr(len(str(set(str(not()))))+int(not())) +21,chr(len(str(set(str(not()))))+(not())) 22,chr(len(str(type(iter(set()))))) -23,chr(len(str(type(iter(set()))))+int(not())) +23,chr(len(str(bin))) 24,chr(len(str(type(iter(bytes()))))) -25,chr(len(str(set(str(set()))))) +25,chr(len(str(ascii))) 26,chr(len(str(type(iter(dict()))))) -27,chr(len(str(type(iter(dict()))))+int(not())) +27,chr(len(str(type(iter(dict()))))+(not())) 28,chr(len(str(type(iter(str()))))) -29,chr(max(range(len(str(zip()))))) -30,chr(len(str(zip()))) -31,chr(len(str(zip()))+int(not())) +29,chr(len(str(type(iter(str()))))+(not())) +30,chr(int(str(len(hex(int())))+str(int()))) +31,chr(max(range(ord(min(str(range(int()))))))) 32,min(str(range(int()))) -33,chr(ord(min(str(range(not()))))+int(not())) +33,chr(ord(min(str(range(not()))))+(not())) 34,min(repr(repr(str()))) 35,chr(len(str(reversed(str())))) -36,chr(len(str(reversed(str())))+int(not())) -37,chr(len(str(reversed(str())))+len(str(dict()))) -38,chr(len(str(reversed(str())))+len(hex(int()))) +36,chr(len(str(reversed(str())))+(not())) +37,chr(len(str(reversed(str())))+(not())+(not())) +38,chr(max(range(ord(max(repr(str())))))) 39,max(repr(str())) 40,min(str(set())) 41,max(str(tuple())) -42,chr(ord(max(str(tuple())))+int(not())) -43,chr(ord(max(str(tuple())))+len(str(dict()))) +42,chr(ord(max(str(tuple())))+(not())) +43,chr(ord(max(str(tuple())))+(not())+(not())) 44,max(str(tuple(repr(str())))) -45,chr(sum(range(int(str(int(not()))+str(int()))))) +45,chr(max(range(ord(min(str(float())))))) 46,min(str(float())) 47,chr(max(range(ord(str(int()))))) 48,str(int()) -49,str(int(not())) -50,str(len(str(dict()))) +49,str(+(not())) +50,str((not())+(not())) 51,str(len(hex(int()))) 52,str(len(str(not()))) 53,str(len(str(set()))) 54,str(len(str(complex(not())))) 55,max(str(ord(max(str(not()))))) 56,max(str(ord(str(int())))) -57,max(str(ord(str(int(not()))))) +57,max(str(ord(str(+(not()))))) 58,chr(ord(str(int()))+ord(min(str(credits)))) 59,chr(ord(str(int()))+len(str(range(int())))) -60,next(iter(str(object()))) +60,next(iter(str(str))) 61,chr(ord(str(int()))+len(str(type(int())))) -62,next(reversed(str(object()))) +62,next(reversed(str(str))) 63,chr(ord(str(int()))+len(str(type(float())))) 64,chr(ord(str(int()))+len(str(type(object())))) 65,chr(ord(str(int()))+len(str(type(complex())))) 66,chr(sum(range(len(set(str(type(bytes()))))))) 67,next(iter(str(copyright))) -68,chr(ord(next(iter(str(copyright))))+int(not())) -69,chr(ord(max(repr(str())))+len(str(zip()))) -70,min(str(not(not()))) -71,chr(ord(next(iter(str(not(not())))))+int(not())) -72,chr(ord(min(str(not(not()))))+len(str(dict()))) +68,chr(ord(next(iter(str(copyright))))+(not())) +69,chr(max(range(ord(min(str(()in())))))) +70,min(str(()in())) +71,chr(ord(min(str(()in())))+(not())) +72,chr(ord(min(str(()in())))+(not())+(not())) 73,chr(ord(str(int()))+len(str(set(str(set()))))) -74,chr(ord(str(int()))+len(str(type(iter(dict()))))) -75,chr(ord(min(str(not(not()))))+len(str(set()))) +74,chr(ord(next(iter(str(str))))+len(str(dict))) +75,chr(ord(min(str(()in())))+len(str(set()))) 76,chr(ord(str(int()))+len(str(type(iter(str()))))) -77,chr(ord(str(int()))+max(range(len(str(zip()))))) -78,chr(ord(str(int()))+len(str(zip()))) -79,chr(ord(str(int()))+len(str(zip()))+int(not())) +77,chr(max(range(sum(range(len(str(set))))))) +78,chr(sum(range(len(str(set))))) +79,chr(sum(range(len(str(set))))+(not())) 80,chr(ord(min(str(set())))+ord(min(str(set())))) -81,chr(ord(max(str(tuple())))+ord(min(str(set())))) -82,chr(ord(str(int()))+ord(min(repr(repr(str()))))) +81,chr(sum(range(len(str(set))))+len(hex(int()))) +82,chr(sum(range(len(str(set))))+len(str(not()))) 83,chr(max(range(ord(min(str(not())))))) 84,min(str(not())) -85,chr(ord(min(str(not())))+int(not())) -86,chr(ord(min(str(not())))+len(str(dict()))) +85,chr(ord(min(str(not())))+(not())) +86,chr(ord(min(str(not())))+(not())+(not())) 87,chr(ord(min(str(not())))+len(hex(int()))) 88,chr(ord(min(str(not())))+len(str(not()))) 89,chr(ord(min(str(not())))+len(str(set()))) -90,chr(ord(min(str(not())))+len(str(complex(not())))) -91,chr(ord(min(str(not())))+len(repr(str(set())))) +90,chr(max(range(sum(range(len(str(dict))))))) +91,chr(sum(range(len(str(dict))))) 92,max(repr(repr(repr(str())))) -93,chr(ord(max(repr(repr(repr(str())))))+int(not())) +93,chr(ord(max(repr(repr(repr(str())))))+(not())) 94,chr(ord(str(int()))+ord(min(str(float())))) 95,min(max(vars())) -96,chr(ord(min(min(locals())))+int(not())) +96,chr(ord(min(min(vars())))+(not())) 97,chr(max(range(ord(max(bin(int())))))) 98,max(bin(int())) -99,chr(ord(max(bin(int())))+int(not())) +99,chr(ord(max(bin(int())))+(not())) 100,next(reversed(hex(ord(max(str(dict())))))) 101,next(reversed(str(not()))) 102,next(iter(str(frozenset()))) -103,chr(ord(next(iter(str(frozenset()))))+int(not())) -104,chr(ord(max(bin(int())))+len(str(complex(not())))) -105,chr(ord(max(bin(int())))+len(repr(str(set())))) +103,chr(ord(next(iter(str(frozenset()))))+(not())) +104,chr(max(range(sum(range(len(repr(str(set)))))))) +105,chr(sum(range(len(repr(str(set)))))) 106,max(str(complex())) -107,chr(ord(max(str(complex())))+int(not())) -108,chr(ord(max(bin(int())))+ord(min(str(credits)))) -109,chr(ord(max(bin(int())))+len(str(range(int())))) +107,chr(ord(max(str(complex())))+(not())) +108,chr(ord(max(str(complex())))+(not())+(not())) +109,chr(ord(max(str(complex())))+len(hex(int()))) 110,chr(max(range(ord(max(oct(int())))))) 111,max(oct(int())) -112,chr(ord(max(oct(int())))+int(not())) -113,chr(ord(max(oct(int())))+len(str(dict()))) +112,chr(ord(max(oct(int())))+(not())) +113,chr(ord(max(oct(int())))+(not())+(not())) 114,max(str(range(int()))) -115,max(str(not(not()))) -116,max(str(set())) -117,max(str(not())) +115,max(str(()in())) +116,max(str(set)) +117,max(str(bin)) 118,max(str(vars)) 119,max(str(pow)) 120,max(hex(int())) 121,max(str(credits)) 122,max(str(zip)) 123,min(str(dict())) -124,chr(ord(min(str(dict())))+int(not())) +124,chr(ord(min(str(dict())))+(not())) 125,max(str(dict())) -126,chr(ord(max(str(dict())))+int(not()))`; - -const astrixData = `64,chr(ord(min(str(range(not()))))*(int(not())+int(not())))`; +126,chr(ord(max(str(dict())))+(not()))`; const periodData = `66,max(str(bytes())).upper() 69,next(reversed(str(not()))).upper() @@ -143,9 +141,7 @@ const periodData = `66,max(str(bytes())).upper() 87,max(str(pow)).upper() 88,max(str(object())).upper() 89,max(str(credits)).upper() -90,max(str(zip)).upper() -91,chr(ord(max(str(zip)).upper())+int(not())) -99,next(iter(str(copyright))).lower()`; +90,max(str(zip)).upper()`; function mapCharacters(csvData) { const charMap = {}; @@ -160,13 +156,11 @@ function mapCharacters(csvData) { } const charMapPeriod = mapCharacters(periodData); -const charMapAstrix = mapCharacters(astrixData); function replaceAndJoin(input) { const asciiValues = Array.from(input, char => char.charCodeAt(0)); let map = mapCharacters(csvData); if($('period').checked) Object.assign(map, charMapPeriod); - if($('astrix').checked) Object.assign(map, charMapAstrix); let out = asciiValues.map(char => map[char] || ` `).join('+'); return $('eval').checked ? `exec(${out})` : out; }