3

I will first say, broadly: I understand that you're constrained by the demands of the assignment, but the assignment doesn't make any sense. It isn't your fault, but like - some of the features are pointless. Allowing the user to check whether a username exists in the list is pointless. There are ways to construct a semi-realistic scenario that exercise the ...


3

There's some odd features to this code, even for a coding practice exercise. Python of course has a couple of list sorting techniques which you should absolutely use in normal circumstances. So accepting that you are doing this for practice, I wonder what the point of the duplicatelist is? Or indeed temp? Are these development fossils of some earlier process ...


3

I'm not going to go too heavily into refactoring the whole thing. Some basic readability things: return_values = compare(options[0], options[1], score) score = return_values[1] lost = return_values[0] It would be much clearer if you did: lost, score = compare(options[0], options[1], score) You have indented things with two spaces, which is odd, normally ...


3

Goal The goal is to optimize the program. I won't change the backtracking algorithm. General feedback Your code is good, but you should use structs and impls in this program, instead of passing grid: [[i8; 9]; 9] around. I show this in code below. Idea You check cell vacancy with many loops that check multiple cells. How about we kill many birds with one ...


2

This is a fun project. Here are a few things I noticed: $AlivePercChance implies that it's a percentage (30%) rather than a fraction (0.3). You might consider renaming it to $AliveChance Why did you flatten the 2D array to 1D? It adds substantial overhead (2 extra function calls * $Width * $Height per screen write, way more for checking neighbors) and ...


2

Good things You mostly follow PEP8 styling conventions, making your code quite readable. The only exception I see is an extra blank line at the beginning of the score and play methods. Also, it is good thinking to wrap your game state into a class for future integration into a more complex project. It is also a good use of a main guard at the end. However, ...


1

Hello and welcome to the Rust community. Correctness Are you sure the code is correct? The regex looks odd, but ok. It seems that Tag::Close does not carry any meaningful info, even though it contains a String. Manual Be sure to read up on if let statements. They are useful for concise and idiomatic code. Here, catch some reading material: https://doc.rust-...


Only top voted, non community-wiki answers of a minimum length are eligible