Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)ST
Posts
4
Comments
10
Joined
1 mo. ago

  • Nice! Some feedback (on your Python, I don't speak Greek):

    • In Python, the idiomatic way to name variables and functions is snake_case -- for example, greekTranslation should be greek_translation. (EDIT after seeing your most recent reply: good luck with that when it comes to Python :) )
    • You're currently recomputing reverseTranslation every time the user requests an English-to-Greek translation. Unless you're planning to modify greekTranslation while the program is running, it would likely be more efficient to make reverseTranslation a global variable, computed just once at the start of the program.
    • The control flow in the main program could be a bit more clear:
      • The condition in while optionSelection == <'practice'/'translation'> makes it look like optionSelection could change to something else inside the loop, yet you never do so. You could just write while True instead.
      • Instead of putting the "Please select either practice, translate, or exit" check up front, it would likely be more maintainable to add it as an else branch to the main if-elif-elif chain. That way, if you added in a new option, you would only have one place in the code to modify instead of two. (Also, instead of x != a and x != b and x != c, you could write x not in [a, b, c]).
      • Speaking of the if-elif-elif chain, you could replace it with a match statement, which would remove the repetitions of optionSelection ==.

    Here's how I would write the control flow for the last section:

     python
        
        optionSelection = input().strip().lower()
        match optionSelection:
            case 'practice':
                while True:
                    practiceGreek()
                    print('')
                    print('Would you like another? [yes] [no]')
                    print('')
                    selection = input().strip().lower()
                    print('')
                    if selection != 'yes':
                        break
            case 'translate':
                while True:
                    translateToGreek()
                    print('')
                    print('Would you like to translate another phrase? [yes] [no]')
                    print('')
                    selection = input().strip().lower()
                    print('')
                    if selection != 'yes':
                        break
            case 'exit':
                print('')
                print('Thank you for using the Greek Practice Program!')
                print('')
                sys.exit()
            case _:
                print('')
                print('Please select either practice, translate, or exit')
                print('')
    
      

    (You could probably pull the while True loops into their own dedicated functions, actually.)

    Hope that helps. Feel free to ask if any of this doesn't make sense.

  • Even regular Rust code is more "exciting" than Python in this regard, since you have a choice between self, &self, and &mut self. And occasionally mut self, &'a self, and even self: Box<Self>. All of which offer different semantics depending on what exactly you're trying to do.

  • Programming @programming.dev

    Fixed Points and Strike Mandates - Paul Khuong: some Lisp

  • ...Interesting idea. (And also interesting lore implications? Not that the game has any...)

    My main thinking right now is: on startup, have the player on an empty field and force them to move (on both inner and outer "axes") onto a specially marked square (and press spacebar) to enter the main menu. (Controls and what they do will be explained in text.) This gets them accustomed to moving around and pressing the CONFIRM key for menuing.

    Then have a special tutorial level to introduce the actual gameplay -- similar to the "real" levels, but much slower BPM and attacks are scripted instead of randomly chosen. I don't want to force anyone to complete the tutorial before entering the actual levels, but it would be the menu item that the player first lands on (aside from maybe the one for changing the controls to something less strange than A/D/J/L).

    The tutorial level would require some more code, but at this point that might be worth it. (And also it would add another option for user-made custom levels if somehow people decide to edit those in.)

    ...Honestly, the one thing I'm most concerned about at the moment is getting players to read text, especially if it's off to the side to avoid covering the playfield.

  • Probably a good idea, but not one that fits my current vision of the game, unfortunately. Especially since my main idea for adding complexity is increasing the number of sides (square->pentagon->hexagon), so each level already has a different-looking playfield.

  • That was certainly not the first piece of feedback I was expecting to get, but it is one that's good to take into account! I forgot that what seems obvious to me might not be obvious to people who've never seen the game before. I'd like it if players could learn the full game without resorting to textual tutorials, so I'll have to find ways to teach things more clearly, but for now I've updated the README to hopefully make things more clear. Thanks for the feedback!

  • Game Development @programming.dev

    I'm making a game called In-Ring Out-Ring, here's a demo

  • Interesting way of handling project vs global scope:

    Some package managers (e.g. npm) use per-project scope by default, but also allow you to install packages globally using flags (npm install -g). Others (e.g. brew) use global scope.

    I like the idea of allowing both project and global scope, but I do not like the flags approach. Why don't we apply a heuristic:

    If there is a .sqlpkg folder in the current directory, use project scope. Otherwise, use global scope.

    This way, if users don't need separate project environments, they will just run sqlpkg as is and install packages in their home folder (e.g. ~/.sqlpkg). Otherwise, they'll create a separate .sqlpkg for each project (we can provide a helper init command for this).

    Seems rather implicit, though, especially if the command output doesn't specify which scope a package was installed in. If a user moves to a subdirectory, forgets they are there, and then tries to install a package, the package will unexpectedly install in global scope (though this particular version of the problem can be solved by also looking in parent directories).

  • Played a few rounds just to get an idea of what the game's like. Seems interesting. It took a while to actually figure out what controls were available and what the cards might do. Sometimes the stickmen would group up in the left corner and stay there for a good while, and there was seemingly nothing that could be done about it. The mechanism for scrolling felt a bit awkward to me, especially since the screen scrolled by such a large amount per click. Just some general notes about my experience, take them into account in whatever way best suits your game's vision.

  • Rust @programming.dev

    Patterns for Modeling Overlapping Variant Data in Rust

  • Can't resist pointing out how you should actually write the function in a "real" scenario (but still not handling errors properly), in case anyone wants to know.

    If the list is guaranteed to have exactly two elements:

     rust
        
    fn is_second_num_positive_exact(input: &str) -> bool {
        let (_, n) = input.split_once(',').unwrap();
        n.parse::<i32>().unwrap() > 0
    }
    
      

    If you want to test the last element:

     rust
        
    fn is_last_num_positive(input: &str) -> bool {
        let n = input.split(',').next_back().unwrap();
        n.parse::<i32>().unwrap() > 0
    }
    
      

    If you want to test the 2nd (1-indexed) element:

     rust
        
    fn is_second_num_positive(input: &str) -> bool {
        let n = input.split(',').nth(1).unwrap();
        n.parse::<i32>().unwrap() > 0
    }
    
      
  • Programming @programming.dev

    This Overly Long Variable Name Could Have Been a Comment | Jonathan's Blog