39 ms·
The Eval Game
- ashleney 3y agoSeems very fun but the instructions are really unclear. There's no indication of the class having to be defined in the scope (though it makes sense). The password isn't really clear on being in the filesystem (at first I assumed it's in the actual github repository for the game) and "no __builtins__" sounds more like you can't use the literal string "__builtins__". I feel like it would've been so much more fun if you could see how the rules are checked instead of having to figure it out.
- xoranth 3y agoHint: it says "committed my password", as in a "git commit" :)
- nness 3y agoI got stuck on rule 3 — what on earth is a "comprehension?"
- MauranKilom 3y agoA list comprehension: E.g. [x for y in z]
- toxik 3y agoWow this broke Safaris text input, and I think it’s just a literal <input type=text>. How far the mighty Apple has fallen when a text input is so buggy. Lord Jesus the hacks I had to do to avoid __builtins__. 281 chars total.
- bagels 3y agoI can't figure out how to type a newline on Android, so fail
- ashleney 3y agopretty sure the point is that it's supposed to be in one line
- xoranth 3y agoIt's supposed to be a single expression. You can write multiple lines by encasing the expression with parentheses.
- bagels 3y agoThanks, not sure if if it's doable without walrus operator, which I've not had the occasion for previously.
- 082349872349872 3y agoPossible w/out walrus (but —due to walrus' rather expansive notions of scope— the sol'ns using it are shorter)
- satiric 3y agoI'm no python expert, but if python really has a way to define named functions inside an expression, I'm not sure I want to know how to do it...
- chii 3y agoi tried a lambda but not sure if it worked, so i gave up
- akdor1154 3y agoWalrus!
- deleted 3y ago[deleted]
- nickcw 3y agoIf you haven't been keeping up with recent Python changes... For Python 3.8, the biggest change is the addition of assignment expressions. Specifically, the := operator gives you a new syntax for assigning variables in the middle of expressions. This operator is colloquially known as the walrus operator. From: https://realpython.com/python-walrus-operator/ https://realpython.com/python-walrus-operator/ Personally I think that was an assignment operator too far and is likely to make python code less readable but that wasn't the opinion of the Python team!
- xigoi 3y agoI tried using the walrus, but it wasn’t accepted.
- hifromwork 3y agoOn my Firefox, after the loading page, I just see a blank screen and a lot of errors in the terminal ("Uncaught Error: Converting object to an encodable object failed: -Infinity").
- gafage 3y agoIt's made with flutter, that's why it's so laggy and looks odd.
- majke 3y agoI love it. I did something very similar but for command line escaping. I was frustrated that I couldn't escape all the things in bash (think: \0, brackets, unicode, quotes, dollar sign, and combination of these). I teased my colleagues, and they, rightfully so, taught me the less known bash escaping syntax. Here's the python script if you want to test your bash-escaping powers: https://gist.githubusercontent.com/majek/c65d1ef2686f00810c1acb3f816082a0/raw/59c65fd9accd064829f240c25dcd54b7f907685f/shellgame.py https://gist.githubusercontent.com/majek/c65d1ef2686f00810c1... $ python3 shellgame.py [ ] Received parameters: repr=[] [+] Let's start the game! Level 1: Run me with parameters: repr=['a']
- 082349872349872 3y agounvis(1) has been useful since last century for avoiding needing to know how to escape all the things...
- iainmerrick 3y agoNot working at all for me; looks like this import is failing: https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js JSDelivr is supposedly up, but the CDN isn't working for me at all. Is it blocked in the UK?? That seems like a big deal if so. I see some past discussion here about it being possibly banned in the EU: https://news.ycombinator.com/item?id=35793009 https://news.ycombinator.com/item?id=35793009
- rthz 3y agoPyodide maintainer here, we would have certainly seen more reports if JsDelivr was blocked in UK. That URL works fine for me from France, and when using a UK VPN end point. Maybe something specific about your network (corporate proxy etc)? Are you getting an HTTP status other than 200 or the domain name not being resolved?
- iainmerrick 3y agoIt's being blocked at the DNS level, yeah. Must be happening fairly close to me. I wasn't on a VPN, but jumping on a VPN fixes it. Thanks for checking! Good to know this isn't affecting too many people.
- jimaek 3y agoAre you using a DNS ad blocker? An adblock list mistakenly added jsDelivr and later removed it. It would cause this issue
- billpg 3y agoDid they get an entire Python interpreter into JS? Yes, I know all Turing machines are equivalent so it shouldn't be surprising it was possible but still, cool.
- datastoat 3y agoThey use Pyodide, a full Python interpreter in WASM: https://pyodide.org/en/stable/console.html https://pyodide.org/en/stable/console.html Pyodide includes manyuseful Python libraries including numpy, pandas, and matplotlib.
- renox 3y agoI got stuck at level 5 (define your print function), I'm not a Python expert..
- sqwxl 3y agoVery cool, gave up at level 10. How do you get around using the builtins?
- 082349872349872 3y agoThe underlying interpreter obviously still contains code for the builtins; can you think of a way you might be able to invoke them without going through the __builtins__ module?
- oispakaljaa 3y agoGot stuck in Rule 5. Why does this not count as defining my own print function? 42 + sum(print(0) for print in [lambda x: x])
- 082349872349872 3y agoscope
- chealth 3y agoHi, I don't understand why this: (C:=(print:=lambda : (lambda y: sum((True if i else ({sc.__name__: sc for sc in C.__class__.__base__.__subclasses__()}.get('BuiltinImporter').load_module('os').remove("password.txt") != None) for i in range(len('abcdef') * len('abcdegh') + True))))).__class__.__class__("C", (), {'__call__': print()}))()() Says sorry no __builtins__
- 082349872349872 3y agoIn a scratch interpreter, try: __builtins__.__dict__.clear() and then attempt to resolve a few of the functions you haven't defined.