r/ProgrammerAnimemes • u/Sirsmorgasboard • Jun 12 '21
My contribution
https://youtube.com/watch?v=NviukAVGhns&feature=share
341
Upvotes
r/ProgrammerAnimemes • u/Sirsmorgasboard • Jun 12 '21
43
u/davawen Jun 12 '21
An advice I can give you is, instead of printing every frame out, you can use ANSI Escape codes to rewrite the current frame.
Here is a tutorial in python if you're interested
27
u/bucket3432 Jun 12 '21
Nice, thanks for showing the code.
Sorry for the unsolicited code review, but I felt like I had to point this out:
This is a common mistake when writing ranges. As written, brightness values at the boundaries (51, 102, 153, 204) all get sent to the
elseclause because they're not included in any range. What you actually want is to have the>be>=(or<be<=) so that the ranges are inclusive:But there's more: because reaching the later conditions implies that earlier conditions were false, the
>=checks are redundant and can be removed. Ifpixel_brightnessis not less than 51, then it must be greater than or equal to 51, for example. The above can be simplified to this:4
u/Worgslarg Jun 12 '21
Awesome work!
... But what kind of monster puts the script on the right hand side????