HackerTrans
TopNewTrendsCommentsPastAskShowJobs

adhami

no profile record

Submissions

Game 987, Like 2048 but Fibonacci

987.reflex.dev
13 points·by adhami·2 anni fa·1 comments

comments

adhami
·28 giorni fa·discuss
it's possible! although many of the constraints in this blog were because we wanted to work with ast module in Python. If we were allowed to create our own types, we can do so much better. I think ruff has an even faster walk by those standards.

It seems bandit is using some decent optimizations already, looking at the `@test.checks("Call")` seems like they already captured some easy wins.

The largest win honestly would be using the same ast.walk for multiple rules, which we also did, but not mentioned in the blog.
adhami
·28 giorni fa·discuss
only because I'm too lazy to learn how to write C with Python, if anything Rust wasn't helpful with all of those unsafes
adhami
·2 anni fa·discuss
I was wondering how 2048 would feel like if instead of powers of two, we can merge consequent fibonacci numbers. Turns out to be a rather interesting game that is fairly forgiving and grows very slowly. I found it difficult to come up with an overall strategy. I had a simple search algorithm that was able to achieve a score of exactly 66,666 (not joking). Getting a 987 block shouldn't be difficult.

You can take a look into the code here: https://github.com/adhami3310/987 (the simple search algorithm is inside the code as well)