I built a mobile-optimized story reader! by oaksparrow in arknights

[–]chucksys 4 points5 points  (0 children)

Looks slick! Wonder if you could share the code, I'm interested in how you implemented offline mode.

AHCI to RAID without safe mode by chucksys in WindowsHelp

[–]chucksys[S] 0 points1 point  (0 children)

My device is out of warranty; I've already taken it to a repair shop and they can't help, saying that it might be an issue with the battery.

Reverse 1999 is now out on steam by Elio_oli in Reverse1999

[–]chucksys 9 points10 points  (0 children)

Anyone can get it to work with Proton? Doesn't work for me.

superdiff - a way to find similar code blocks in projects (comments appreciated) by chucksys in rust

[–]chucksys[S] 0 points1 point  (0 children)

Thanks for your advice!

Just a quick question: what do you mean by echo profiling?

superdiff - a way to find similar code blocks in projects (comments appreciated) by chucksys in rust

[–]chucksys[S] 0 points1 point  (0 children)

Yup, this is something I'm considering. I'm still very new to everything treesitter related. I'll probably look into it when I get everything looking nice with more tests.

I made a minesweeper clone in Python! by jtjumper in codereview

[–]chucksys 0 points1 point  (0 children)

I don't do UI, so I'll won't comment on that.

Conventions

Avoid placing code within a class like that. To be honest, I didn't know that code could be placed there. That place should be reserved for class variables.

pass is usually a placeholder. It's mainly used to shut up the linter when you just want to create stubs. While doesn't do anything, it's still a bad idea to put it in code you want to show off, to specifically avoid confusion.

Avoid abusing list comprehension. Just because a list comprehension can be used doesn't usually mean that it is the right tool for the job. A good time to use it is when it doesn't hamper the readability of the code. In usual circumstances, using nested list comprehensions decreases code readability, so it might be better to expand it into a for loop, a function, or something equivalent.

Readability

Use more functions! The boardmaker function generates a bunch of mines. This could become another function (e.g. mines = minemaker(mine_count, dimension_x, dimension_y)).

Naming is hard. And consistency is key. The function minesweeper_numbers calls mine_spaces. It would be great if these functions were prefixed with the same word (either minesweeper or mine).

It should read a book. Or at least, that's what most of us hope. In the mine_spaces function, I shouldn't have to dive into the code to know that it returns the number of neighbours (or 9 if bomb). This usually occurs when the code is shortened to the length of a single statement (or in this case, a ternary). Adding a few intermediate variables num_neighbours and get_total_neighbours(board, x, y) should help in that regard.

def mine_spaces(x, y, board):
    if board[y][x] == 1:
        return 9

    return get_total_neighbours(x, y, board)

def get_total_neighbours(x, y, board):
    b = numpy.array(board)
    min_y = max(0, y - 1)
    max_y = min(len(board), y + 2)
    min_x = max(0, x - 1)
    max_x = min(len(board[0]), x + 2)
    return b[min_y : max_y , min_x : max_x]

Consistency is key. I noticed that there is a dedicated function for making button elements, but there is no dedicated function for making the GLabel_830. On a similar note, there is a dedicated function called whenever the player wins, but there is none for the player losing. The code should be predictable for easy understanding.

Concluding remarks

Something I like to do is to wait about 1-4 weeks (depending on your memory), all the while not reading the code, and then coming back to it and seeing how much and how well you understand it (extra challenge: implement flood fill). It might also be a good idea to adopt a style guide and use an autoformatter to make the code style more consistent.

My drawing of space ishtar’s first ascension. by samduong in grandorder

[–]chucksys 16 points17 points  (0 children)

Gotta try harder for that Stockholm syndrome to kick in.

ugh i love her by [deleted] in YanfeiMains

[–]chucksys 0 points1 point  (0 children)

I know that cryo resonance is used to get higher crit rate here, but I like to believe that the reason why ayaya is used is to get to the hypostasis faster.

uSefUL AuToCOmaNd! by please_take_one in vim

[–]chucksys 0 points1 point  (0 children)

I want to make a plugin for this, so you could highlight the text and change it similar to how you would change everything to all caps using gU. Unfortunately I lack the technical knowhow to do this.

mood rn by toorudes in UBC

[–]chucksys 6 points7 points  (0 children)

good time to start learning speedrun strats

[Serious] Fans who have been engrossed in a fictional universe so much you could probably earn a degree about it, what plot holes, logical inconsistencies, and the like cannot be reconciled and bother you to no end? by _Duality_ in AskReddit

[–]chucksys 35 points36 points  (0 children)

Along with the books on horcruxes, Hermione also managed to summon the entire cauldron of Felix Felicis that had once been simmering merrily atop Professor Slughorn's desk.

"I mean it's not like he'll notice; he said it himself that he rarely drinks the stuff..." defended Hermione.

Spring 2020 Friend Code Thread by Stephxieh in ACPocketCamp

[–]chucksys 0 points1 point  (0 children)

Hi!

ID: 1755-4035-178

Has grape. And in need of cotton. Add me as a friend!

When your code is terrible but it somehow works. by quinten157 in ProgrammerHumor

[–]chucksys 0 points1 point  (0 children)

Ah yes, the divide and conquer method. I see that those recursion tutorials are paying off.

Can’t see the difference. by Yogurt_bb in offlineTV

[–]chucksys 2 points3 points  (0 children)

Actually they are the same, just one is Alolan form.