krg's recent activity

  1. Comment on What are you doing this weekend? in ~talk

  2. Comment on What have you been listening to this week? in ~music

    krg Link Parent
    Oh, yea. I will, for sure. This is a cool talk she gave, if you're interested.

    Oh, yea. I will, for sure. This is a cool talk she gave, if you're interested.

    1 vote
  3. Comment on What have you been listening to this week? in ~music

    krg Link Parent
    Damn... I listened to so much Masters of the Universe some years ago... 😭 Haven't heard Holly Herndon's new EP, but her last album was damn solid. πŸ‘Œ

    Damn... I listened to so much Masters of the Universe some years ago... 😭

    Haven't heard Holly Herndon's new EP, but her last album was damn solid. πŸ‘Œ

    2 votes
  4. Comment on Programming Challenge: Dice Roller in ~comp

    krg Link Parent
    Haha, yea. Figured it didn't really matter on any modern system. For some reason it just feels more satisfying using as small a variable as possible. I also want to be exposed to type errors so I...

    Haha, yea. Figured it didn't really matter on any modern system. For some reason it just feels more satisfying using as small a variable as possible. I also want to be exposed to type errors so I can figure out how to fix em. For example, ordinal_append() initially didn't have .to_string() attached, which gave me a type error.

    DMOJ looks like a cool spot for problems. Gotta practice my Rust syntax some more...

    2 votes
  5. Comment on Programming Challenge: Dice Roller in ~comp

    krg (edited ) Link Parent
    Yea, I wasn't quite sure if it'd evaluate, either..until I tried it! This is the function I ended up with: fn ordinal_append(n: u32) -> String { match if (n % 100) < 20 { n % 100 } else { n % 10 }...

    Yea, I wasn't quite sure if it'd evaluate, either..until I tried it!

    This is the function I ended up with:

    fn ordinal_append(n: u32) -> String {
    	match if (n % 100) < 20 { n % 100 } else { n % 10 } {
    		1 => "st",
    		2 => "nd",
    		3 => "rd",
    		11 ... 20 | _ => "th",
    	}.to_string()
    }
    

    The only pain being that Rust is strongly typed and anything that gets thrown into the function has to be cast as a u32. I initiated the dice values as u8, since that seems to be enough for dice and maybe I save a few bytes of memory?

    Edit: Ooo, also didn't consider anything past 100, so 111 shows as "111st" instead of "111th." Well, better fix that...

    EditEdit: Okay, fixed. I think.

    2 votes
  6. Comment on What have you been listening to this week? in ~music

    krg (edited ) Link
    Been listening to a lot of Geotic and was even inspired to start on a track inspired by his stuff (read: "ripping off"). As with most of the stuff I've been posting, that's just a basic outline....

    Been listening to a lot of Geotic and was even inspired to start on a track inspired by his stuff (read: "ripping off"). As with most of the stuff I've been posting, that's just a basic outline. Gotta add a melody, work on transitions, add a bit more spice, etc...

    Oh, and my chart.

    1 vote
  7. Comment on Programming Challenge: Dice Roller in ~comp

    krg Link Parent
    Okay, so this also seems to work: match if (i + 1) < 20 {(i + 1)} else {(i + 1) % 10} { 1 => println!("{}st roll: {}", (i + 1), rolls[i]), 2 => println!("{}nd roll: {}", (i + 1), rolls[i]), 3 =>...

    Okay, so this also seems to work:

    	match if (i + 1) < 20 {(i + 1)} else {(i + 1) % 10} {
    		1 => println!("{}st roll: {}", (i + 1), rolls[i]),
    		2 => println!("{}nd roll: {}", (i + 1), rolls[i]),
    		3 => println!("{}rd roll: {}", (i + 1), rolls[i]),
    		11 ... 20 | _ => println!("{}th roll: {}", (i + 1), rolls[i]),
    	}
    

    but maybe it can be cleaner. I guess I can separate it into its own function.

    4 votes
  8. Comment on Programming Challenge: Dice Roller in ~comp

    krg Link Parent
    Ah, yea. Didn't consider that case. And I figured I'd use the remainder operator, but I must've forgot how it worked. Ha, that was going to be my go to solution but talked myself out of it.

    Ah, yea. Didn't consider that case. And I figured I'd use the remainder operator, but I must've forgot how it worked. Ha, that was going to be my go to solution but talked myself out of it.

    2 votes
  9. Comment on Programming Challenge: Dice Roller in ~comp

    krg Link Parent
    Purely for nice looking ordinal printing. E.g., "1st roll, 2nd roll, 3rd roll" etc. My solution handles up to "10th", but adds "th" to each subsequent number. If I checked only the last digit I...

    Purely for nice looking ordinal printing. E.g., "1st roll, 2nd roll, 3rd roll" etc. My solution handles up to "10th", but adds "th" to each subsequent number. If I checked only the last digit I believe I'd handle every case. Just an aesthetics thing, not really part of thtw challenge, but a nice little challenge in itself. :)

    I looked up the documentation and some examples on Rust's regular expressions and I understand where I should split, but the syntax is a little confusing to me.

    1 vote
  10. Comment on Programming Challenge: Dice Roller in ~comp

    krg Link
    Cool. Trying this in Rust. I'm not a super adept programmer, so I'm having a bit of trouble splitting the input string by regular expression. If I gather number of dice, number of sides, and...

    Cool. Trying this in Rust. I'm not a super adept programmer, so I'm having a bit of trouble splitting the input string by regular expression. If I gather number of dice, number of sides, and modifiers separately it's a fairly trivial task, but of course that's not in the spirit of the challenge.

    Also, does anyone know how to extract the last digit of a number? I'm trying to be clever and print proper ordinal numbers, but what I have right now only works for the first ten digits.

    match (i + 1) {
    1 => println!("{}st roll: {}", (i + 1), rolls[i]),
    2 => println!("{}nd roll: {}", (i + 1), rolls[i]),
    3 => println!("{}rd roll: {}", (i + 1), rolls[i]), 
    _ => println!("{}th roll: {}", (i + 1), rolls[i]),
    }
    

    Also, there's a lot of repetition, so I imagine it can get even more clever.

    2 votes
  11. Comment on HBO Chernobyl miniseries discussion in ~tv

    krg Link Parent
    You might not be thanking me when you get to certain parts... T_T

    You might not be thanking me when you get to certain parts... T_T

    2 votes
  12. Comment on HBO Chernobyl miniseries discussion in ~tv

    krg Link
    Chernobyl Prayer by Svetlana Alexievich is a must-read if the issues surrounding the disaster interest you. It's sad as hell.

    Chernobyl Prayer by Svetlana Alexievich is a must-read if the issues surrounding the disaster interest you. It's sad as hell.

    6 votes
  13. Comment on The Voynich Manuscript may have successfully been decoded in ~humanities

    krg Link Parent
    The ensuing discussion is more illuminating, I think.

    The ensuing discussion is more illuminating, I think.

    2 votes
  14. Comment on The Voynich Manuscript may have successfully been decoded in ~humanities

  15. Comment on Mid-00s meme factory YTMND has shut down for good in ~misc

    krg Link Parent
    Ah, not playing in Edge or Firefox, but seems to work on Chromium-based browsers.

    Ah, not playing in Edge or Firefox, but seems to work on Chromium-based browsers.

  16. Comment on Mid-00s meme factory YTMND has shut down for good in ~misc

    krg Link Parent
    Alas, no audio...which is what really makes it!

    Alas, no audio...which is what really makes it!

  17. Comment on Mid-00s meme factory YTMND has shut down for good in ~misc

    krg Link
    My favorite. (down, of course :( )

    My favorite. (down, of course :( )

    1 vote
  18. Comment on Avoiding "Health washing" at the Grocery Store in ~food

    krg Link
    Nutrition facts are all I look at when shopping for food. Of course, you have to trust that the batch you're buying is within the bounds of the nutrition facts stated and that the nutrition facts...

    Nutrition facts are all I look at when shopping for food. Of course, you have to trust that the batch you're buying is within the bounds of the nutrition facts stated and that the nutrition facts themselves are accurate. Assuming that's the case, though, you'll find nutrition facts tell pretty much the whole story on weather or not packaged foods can be considered "healthy".* For fresh fruits and vegetables, I may use a tool like WolframAlpha. Here's their entry for avocado. Couple those tools with your dietary goals and you'll be well on your way to truly healthy living.

    *possible contaminants could still be an issue. Or, you may want to know whether a crop was ethically harvested or not. Separate issues from base nutrition, but maybe worth considering...

    2 votes
  19. Comment on Avoiding "Health washing" at the Grocery Store in ~food

    krg Link Parent
    As far as I know, organic foods still use pesticides but they happen to be non-synthetic. You'll be exposed to less, but if you're one to trust regulatory bodies the levels that are present in...

    As far as I know, organic foods still use pesticides but they happen to be non-synthetic. You'll be exposed to less, but if you're one to trust regulatory bodies the levels that are present in non-organic foods is of no concern to begin with. Organic farming practices are not without concerns.

    1 vote
  20. Comment on What’s your favorite soup? in ~food

    krg (edited ) Link Parent
    You'll definitely get a different flavor profile if you aren't using ancho chile peppers (or guajillo..or any other dried chili). They're mild and kind of smokey and permeate the broth, where a...

    You'll definitely get a different flavor profile if you aren't using ancho chile peppers (or guajillo..or any other dried chili). They're mild and kind of smokey and permeate the broth, where a fresh serrano is going to have more bite and probably won't add to the soup as a whole. You might be able to substitute some kind of chipotle sauce, if it's heavy on the chipotle. I don't know what California chili powder is, but it's probably not essential.

    It should be illegal to sell hominy without the other ingredients to make pozole or menudo...

    Edit: After searching for California chili powder, I realize this is what's being referred to, which is just ground Anaheim chilies. Also...jeez, I can get those bags for like a dollar down the street. Living in a highly diverse area has its perks, that's for damn sure.

    3 votes