I write code and play games and stuff. My old username from reddit and HN was already taken and I couldn’t think of anything else I wanted to be called so I just picked some random characters like this:

>>> import random
>>> ''.join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789") for x in range(5)])
'e0qdk'

My avatar is a quick doodle made in KolourPaint. I might replace it later. Maybe.

日本語が少し分かるけど、下手です。

Alt: e0qdk@reddthat.com

  • 1 Post
  • 36 Comments
Joined 1 year ago
cake
Cake day: September 22nd, 2023

help-circle

  • Have you tried Resonance? It’s a mystery adventure game set in modern times where you play as four different characters whose stories interconnect. It’s been a while since I played it (a decade or so?) but I remember that it had an interesting game mechanic that let you use memories like items in various interactions, as well as a number of puzzles that I rather liked the design of.



  • It’s not a GUI library, but Jupyter was pretty much made for the kind of mathematical/scientific exploratory programming you’re interested in doing. It’s not the right tool for making finished products, but is intended for creating lab notebooks that contain executable code snippets, formatted text, and visual output together. Given your background experience and the libraries you like, it seems like it’d be right up your alley.


  • What upside down thing with a banana??

    There was a viral video/meme maybe a decade ago about how monkeys peel bananas (might have actually been an orangutan or gorilla in the one I saw; been too long since I’ve seen it) where they peel it from the end opposite of how people are usually shown doing it. I’m guessing they mean that? Basically, instead of bending the stem bit (from where the bananas bunch up), you can pinch the tip at the other end and the peel splits open very easily – it’s easier to do, especially if the banana is still a bit on the greener side of ripeness and the stem part is flexible. (I tried it after seeing it and switched to peeling them from the “bottom” myself.)

    What back bit?

    There is a little black fibrous part of most Cavendish bananas near the tip I was describing; many people do not like eating it and avoid it.

    Also…veins?

    I’m not sure what they mean either.


  • Can Z3 account for lost bits? Did it come up with just one solution?

    It gave me just one solution the way I asked for it. With additional constraints added to exclude the original solution, it also gives me a second solution – but the solution it produces is peculiar to my implementation and does not match your implementation. If you implemented exactly how the bits are supposed to end up in the result, you could probably find any other solutions that exist correctly, but I just did it in a quick and dirty way.

    This is (with a little clean up) what my code looked like:

    solver code
    #!/usr/bin/env python3
    
    import z3
    
    rand1 = 0.38203435111790895
    rand2 = 0.5012949781958014
    rand3 = 0.5278898433316499
    rand4 = 0.5114834443666041
    
    def xoshiro128ss(a,b,c,d):
        t = 0xFFFFFFFF & (b << 9)
        r = 0xFFFFFFFF & (b * 5)
        r = 0xFFFFFFFF & ((r << 7 | r >> 25) * 9)
        c = 0xFFFFFFFF & (c ^ a)
        d = 0xFFFFFFFF & (d ^ b)
        b = 0xFFFFFFFF & (b ^ c)
        a = 0xFFFFFFFF & (a ^ d)
        c = 0xFFFFFFFF & (c ^ t)
        d = 0xFFFFFFFF & (d << 11 | d >> 21)
        return r, (a, b, c, d)
    
    a,b,c,d = z3.BitVecs("a b c d", 64)
    nodiv_rand1, state = xoshiro128ss(a,b,c,d)
    nodiv_rand2, state = xoshiro128ss(*state)
    nodiv_rand3, state = xoshiro128ss(*state)
    nodiv_rand4, state = xoshiro128ss(*state)
    
    z3.solve(a >= 0, b >= 0, c >= 0, d >= 0,
      nodiv_rand1 == int(rand1*4294967296),
      nodiv_rand2 == int(rand2*4294967296),
      nodiv_rand3 == int(rand3*4294967296),
      nodiv_rand4 == int(rand4*4294967296)
      )
    
    

    I never heard about Z3

    If you’re not familiar with SMT solvers, they are a useful tool to have in your toolbox. Here are some links that may be of interest:

    Edit: Trying to fix formatting differences between kbin and lemmy
    Edit 2: Spoiler tags and code blocks don’t seem to play well together. I’ve got it mostly working on Lemmy (where I’m guessing most people will see the comment), but I don’t think I can fix it on kbin.



  • If I understand the problem correctly, this is the solution:

    solution

    a = 2299200278
    b = 2929959606
    c = 2585800174
    d = 3584110397

    I solved it with Z3. Took less than a second of computer time, and about an hour of my time – mostly spent trying to remember how the heck to use Z3 and then a little time debugging my initial program.




  • I’ve never tried to make a stew out of duck before, but if someone asked me to wing it anyway, I’d probably try to use it in a gumbo: Dark roux, Cajun Trinity (celery + onion + bell pepper), jalapeno, garlic, stock, fresh thyme, bay leaf, lots of fresh ground black pepper, spoonful of hot sauce (e.g. Crystal or Tabasco if I can’t get that), plus your meat – served over white rice. For chicken (e.g. chicken thighs), I’d sear it first but I’m not sure on the best treatment for gamey fowl. Personally I might try to blanch it first to try to reduce the gameyness (based on recommendations I’ve seen about cooking certain kinds of stewed pork – like pork belly in Chinese dishes), but you’d do better to get advice from someone who’s actually cooked with gamey ingredients more than I have if you can.

    Adapting a coq au vin recipe might be another idea to try if gumbo doesn’t appeal, but again, I’ve never tried that with duck either.


  • And Sim Tower I was obsessed with that game for a long time when I was younger. Couldn’t stop playing until I got everything completed and filled every empty space on the map.

    Single, double, or triple story lobby? :-)

    I remember having a pretty good time with SimTower myself – I liked seeing all the little animations of people doing stuff throughout the building. I didn’t understand the apartment pricing thing as a kid, but as an adult thinking back on it, it’s clear that I was supposed to renovate the units if I wanted to keep renting them at the higher rates… (Delete and rebuild was not intuitive to me as a kid so I kept getting frustrated with the apartments and usually built massive amounts of hotel rooms instead.)

    I haven’t heard of Sim Safari myself what was that one like?

    I hadn’t played it for 20+ years so my memory of it wasn’t great when you asked this question – but I went down a bit of a rabbit hole digging through my boxes of old anime DVDs and strange things I burned to CD-Rs as a teenager and such – and it turns out I still have the original CD-ROM! It’s got orange and white stripes. It’s scratched up a little bit, but it’s still readable enough that I was able to install the game under WINE and IT WORKS! (The installer prompted me to install DirectX 5 to “improve performance”… lol)

    The game opens with a short animated splash screen – a map of Africa with animated zebras and other animals shown over it before eventually displaying the game’s logo. It then dumps me onto a main menu with a lantern that toggles an interactive tutorial on and off – somewhat confusingly; it wasn’t immediately clear that it was a switch unlike the other options. I turned the tutorial on but didn’t find it very helpful.

    The game itself is isometric and features a bunch of animals wandering around randomly while grass grows. (Screenshot) There are three different modes (park, camp, village) that I don’t really understand the details of. Park shows your animals, of course. I think the idea is you build up the camp site to get tourists to come (and bring you money), do gardening and animal management and such in the park which attracts more tourists, and hire people from the village to keep things running (otherwise they poach your animals, probably?) but it’s not clear how to actually get things going and most of the advisors seem pretty useless.

    There’s an ecologist adviser who has a field guide about plants and animals and can also show you various graphs and things. You can click on binoculars and then on an animal and it will bring up a window with a little animation of that animal.

    The game constantly plays animal sound effects by default including crickets and various birds and a bunch of animals whose sounds I don’t know well enough to name – but could probably learn from the embedded educational material if I cared to. (I have a feeling many parents of kids who had this game were probably driven bonkers by some animal or other going “AWEEEEE heee heee heee hee!” over and over.)

    I remembered the game being presented as more serious than SimPark (which has a talking cartoon frog guide you through things like leaf identification) – and, indeed, the character graphics are more realistic cartoon drawings in this one, but it’s also more cartoony than I remember with the sound effects for things like a “boing-a-boing-oing-oing” failure noise if you misclick the binoculars.

    The controls are not very good. Moving around the map is tediuous and unintuitive (you have to click in a particular region near the window border and hold the mouse down there – or else pull up a mini-map and navigate with that). The game also just builds paths immediately when you try to draw them with the mouse instead of letting you choose a route and drop to release to confirm the construction. You can “build” a 4 door car on your camp site for some reason as well as construct roads, but I think it may just be a decoration. There doesn’t seem to be any way to pick it up and move it if you plopped it in a bad spot (bye $3k!).

    Unfortunately I don’t have the original box/paper manual/whatever else came with the disc and the README file (in an ancient .DOC format) is not very helpful. It does, however, contain some lines like:

    By the time you read this document, the average home computer might be a 700MHz GazillaComp 2000 with 58 gigabytes of memory.

    which is pretty amusing since the decade old machine I’m running it on has a 3.7GHz processor – obscenely far beyond their dreams of high performance – but a mere 32GB of RAM. :p

    Somewhat oddly the game apparently has the ability to print – although I haven’t tried it.


  • I’ve seen Bubba Ho-Tep and Cemetery Man! Watched them during a movie marathon once that also included From Dusk Till Dawn and Jacob’s Ladder. That was a night well spent.

    Out of the games, I’ve played Sim Tower. I never made it to 5 stars but got as far as building the subway in at least one of my towers. I played way too many sim games as a kid. SimSafari is probably the most obscure I tried – never really made much sense out of that one though.

    I don’t know if it’s that obscure… but for anyone else who played a bunch of sim games – do you remember the song with the lyrics “I’m just a splatter, splatter, splatter on the windshield of life”?


  • Any ways to get around the download failing

    I did this incredibly stupid procedure with Firefox yesterday as a workaround for a failing Google Takeout download:

    • backup the .part file from the failed download
    • restart the download (careful – if you didn’t move/back it up, it will be deleted and you will have to download the whole thing again; found this out the hard way on a 50GB+ file… that failed again)
    • immediately pause the new download after it starts writing to disk
    • replace the new .part file with the old .part file from earlier (or – see [1] below)
    • Firefox might not show progress for a long time, but will eventually continue the download (I saw it reading the file back from disk with iotop so I just let it run)
    • sanity check that you actually got the whole thing and that it is usable (in my case, I knew a hash for the file)

    [1] You can actually replace the new .part file with anything that has the same size in bytes as the old file – I replaced it with a file full of zeros and manually merged the end onto the original .part file with a tiny custom python script since I had already moved the incomplete file to other media before realizing I could try this. (In my case, the incomplete file would still have been useful even with the last ~1MB cut off.)

    There are probably better options in most cases – like Thunderbird for mailbox as other people suggested, or rclone for getting stuff from Drive – but if you need to get Takeout to work and the download keeps failing this may be another option to try.



  • Haven’t used that particular library, but have written libraries that do similar sorts of things and have played with a few other similar libraries in C++ and Haskell. I’ve taken a quick glance at the documentation here, but since I don’t know this library specifically apologizes in advance if I make a mistake.

    For OneOrMore(Word(alphanums)) + OneOrMore(Char(printables)) it looks it matches as many alphanum Words as it can (whitespace sequences being an acceptable separator between tokens by default) and when it hits ( it cannot continue with that so tries to match the next expression in the sequence. (i.e. OneOrMore(Char(printables)))

    The documentation says:

    Char - a convenience form of Word that will match just a single character from a string of matching characters

    Presumably, that means it will not group the characters together, which is why you get individual character matches after that point for all the remaining non-whitespace characters. (Your result also seems to imply there was a semicolon at the end of your input?)

    For OneOrMore(Word(alphanums)) + OneOrMore(Char(string.punctuation)) it looks like it cannot match further than ( since 1 is not a punctuation character; so, you got the tokens for the parts of the string that matched. (If you chained the parser expression with something like + Word(alphanum) I’d expect you’d get another token [i.e. "1"] added onto the end of your result.) You may eventually want StringEnd/LineEnd or something like that – I’d expect they’d fail the parser expression if there’s unconsumed input (for error detection), but again, haven’t used this specific library, so it may work different than I expect.

    There appears to be a Combine class you can use to join string results together; that might be useful for future reference.

    i was trying to parse a string with pyparsing so all the words were separated from the punctuation signs

    Have not tested it (since I don’t have a copy of the library installed anywhere and can’t set up an environment for it easily right now) but perhaps something like OneOrMore(Word(alphanums)|Char(string.punctuation)) would be more like what you are looking for?


  • The attached picture says 133 qubits, so whatever that chip is (edit: Heron) it’s not this thing.

    IBM’s post (that the article links) says:

    Breaking the 1,000-qubit barrier with Condor

    We have introduced IBM Condor, a 1,121 superconducting qubit quantum processor based on our cross-resonance gate technology. Condor pushes the limits of scale and yield in chip design with a 50% increase in qubit density, advances in qubit fabrication and laminate size, and includes over a mile of high-density cryogenic flex IO wiring within a single dilution refigerator.

    So, it sounds like this is actually another fridge sized system.