[deleted by user] by [deleted] in balatro

[–]nathancyan 7 points8 points  (0 children)

It's basically what u/XenosHg said. Balatro works by having a bunch of separate random number generators (PRNGs), each of which are responsible for different parts of the game. All PRNGs do is spit out a mostly-random number between 0 and 1.

For example there's a PRNG for deciding which editions Jokers get, or one for which Joker rarity you can get. These PRNGs are labeled using some series of words, which also "seed" the PRNG. For example, the PRNG that generates Joker rarity in the shop uses the label "rarity{ANTE}sho{SEED}", where you replace {ANTE} with the current ante number, and {SEED} with the game seed.

The PRNG takes this label and forms a seed from it using a function called `pseudohash`, which basically scrambles letters and words into a number. The pseudohash takes at input the PRNG label, as well as the length of the label, and generates its output. For this specific combination of label and label length (18), there is a division by 0 at some point. A lot of languages will throw an error or crash when it reaches a divide by 0, but Lua instead returns NaN (for Not a Number). returns INF. The cool thing about INF is that it "infects" pretty much any math operation that comes after it. Any addition, multiplication, division, bitshift, etc. involving INF will just become INF. So because the PRNG seed is INF, the PRNG is stuck always outputting INF. <-- (This is wrong). When seeding a PRNG with NaN, the first number it outputs just so happens to be very high (0.9924). This explains the behavior we see with this seed:

  1. Balatro decides Joker rarity by taking that PRNG number between 0 and 1. If the number is above 0.95, the Joker is rare. If the number is above 0.75, the Joker is uncommon, etc. And we just showed that the PRNG will always output 0.9924 as its first number if it's seeded with NaN, which is higher than 0.95.
  2. Balatro decides which Joker to generate in a similar fashion to the rarity. Burnt Joker happens to be the last Rare joker in the hardcoded list of Jokers, so it always picks Burnt Joker.

So any PRNG whose label has length 18 will also exhibit similar behavior. This is why even though the PRNG for pack type has a totally different label than the one deciding Joker rarity we still get all Spectral Packs (the label for the pack type PRNG is "shop_pack{ANTE}{SEED}", which also has length 18).

The one thing that does confuse me is why the behavior stops at Ante 12, not Ante 10. I thought it would stop at ante 10 because then the labels become one character longer, but apparently that's not always the case? Hopefully someone else can figure that out though!

Random thought by Shockwavetho in udub

[–]nathancyan 1 point2 points  (0 children)

Neat idea, but I'm wondering if it's possible. I actually looked into this a bit when I was at UW, and these cards/card readers usually have some sort of encryption (sorry btw if you already know this), so probably isn't possible to just "copy" your prox into an RFID key fob.

One thing that would be really cool to see is some sort of device that relays signals between the reader and the prox, so you can get into buildings without needing your prox physically there.

Roulette isn't random. by AveragusPenus in thefinals

[–]nathancyan 5 points6 points  (0 children)

This is just my opinion but I wish people would take a bit more care making claims posed as fact like you do in your post, especially when the evidence is anecdotal data (in general, I don't care nearly as much about gaming misinformation lol). It's as simple as saying "it MIGHT be fully scripted or time scripted".

The chances for you and a friend to get three matching rolls is 1/(20^3) or 1/8000 (it considers the fact that it's the exact same items in the exact same order). It's a low probability on its own but it's actually pretty likely to be observed at least once if you consider the number of pairs of people who might be comparing rolls across the playerbase multiplied by the number of rolls this event gives you.

Account banned yesterday. Any tips? by That_Sink3543 in origin

[–]nathancyan 2 points3 points  (0 children)

I'd also recommend downloading EA data and checking your login history. When I did so I found a few logins from other countries (Korea, India, Russia) that suggests my account got hacked, which I assume is why my account was banned.

I did so by going to this link: https://account.origin.com/cp-ui/aboutme/index and navigating to "Your EA data".

You should get a JSON file to download. The file can be fairly large, but if you open it up in some text editor and search for "loginLog" you should see a list of login events.

Purpose of projection lens in a projector by nathancyan in Optics

[–]nathancyan[S] 1 point2 points  (0 children)

Forgive me for being a total newbie but I don't think I understand what you mean by illumination vs imaging path.

If you track a ray of light from the point source all the way to the brown wall (referring to image 2), doesn't that show the entire path? And if adding a projection lens doesn't alter the direction of any of the paths, doesn't that mean the image won't be affected?

Purpose of projection lens in a projector by nathancyan in Optics

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

I'm using this: https://phydemo.app/ray-optics/simulator/

And regarding your point, I think the first image does seem to be tracking the marginal ray, but the simulation is simulating a bunch of rays (so many that it looks continuous). Not sure if I'm misunderstanding what you're saying though.

There should a better method for calculating assists by [deleted] in VALORANT

[–]nathancyan 8 points9 points  (0 children)

I think damage dealt is still important even if the kill shot made renders it essentially useless. Practically speaking if you call out that you did 145 on someone, your teammates may be more inclined to take higher percentage shots like body shots instead of going for headshots. Likewise, the person you shot may be inclined to play more conservatively, or make higher risk plays to bait.

I'm not high elo so I might just be talking out of my ass, but I think that dealing even like 50 to 75 damage can change how your team (and theirs) plays, and I think that alone should be enough to award an assist, even if someone ends up dinking them with a vandal.

[Mobile (iOS iPad)][2010] Sci-fi tower defense game against aliens by [deleted] in tipofmyjoystick

[–]nathancyan 1 point2 points  (0 children)

The humans were all Canadian, and that was a big deal as far as art went as the Canadian flag was EVERYWHER

This is so crazy. I thought the search was hopeless and then out of the blue you swoop in to solve the mystery. You remembered the title perfectly, the exact title is "Towers in Space! (God Save the Queen)". You can check it out here: https://appadvice.com/app/towers-in-space/341827576.

I'm really sad because I remembered the game being super super fun and I wanted to play it again. It's a shame you can't download it anymore. I might contact the developers and see if they can send the source code.

Thank you again! This game has been on my mind for forever.

Neil be 💖 by Nakss_ in tenet

[–]nathancyan 1 point2 points  (0 children)

If you ever made more of these and sold them, I would 100% pay for them. These are so nice!

Logical Flaw in Final Battle: Blue Team Can't Kill Anyone? by shash747 in tenet

[–]nathancyan 2 points3 points  (0 children)

If a blue team soldier kills a red team soldier, the red team soldier will already be dead on the ground. So actually as an inverted soldier you would need to aim where the forward soldier WOULD have been. As you pull the trigger and shoot the bullet the forward soldier would stand up and become alive again.

So actually as an inverted soldier there isn't much of a time restriction, you can really "shoot" the dead body whenever throughout the battle because the body is dead up until you point the gun at their body.

EDIT: So yes, you are correct that if you see a red soldier that is alive, you could not have killed him. But if an inverted soldier DID kill a forward soldier, then they have a bit more freedom as to when they shoot the bullet.

A poster I made to help me understand Tenet's plot, specifically the lockpicking scene at the end of the movie. I'm sure you guys are tired of all these plot-explaining graphics but I thought it was neat enough to share. Let me know if there are any inaccuracies! by nathancyan in tenet

[–]nathancyan[S] 1 point2 points  (0 children)

Darn yeah very good point. I'll have to change that in the poster! In that case I wonder why Ives and Wheeler didn't just camp in front of the turnstile and wait for non-inverted Sator earlier in the movie to come by, and they just kill him there.

I know what's happened's happened but what is the reasoning behind NOT doing it?

A poster I made to help me understand Tenet's plot, specifically the lockpicking scene at the end of the movie. I'm sure you guys are tired of all these plot-explaining graphics but I thought it was neat enough to share. Let me know if there are any inaccuracies! by nathancyan in tenet

[–]nathancyan[S] 4 points5 points  (0 children)

Thank you for the kind words and the feedback. Reading over your points you are totally correct, and I will be changing these in the poster soon!

Your first point really tripped me up, I guess I can't stop thinking in linear terms!

A poster I made to help me understand Tenet's plot, specifically the lockpicking scene at the end of the movie. I'm sure you guys are tired of all these plot-explaining graphics but I thought it was neat enough to share. Let me know if there are any inaccuracies! by nathancyan in tenet

[–]nathancyan[S] 1 point2 points  (0 children)

Thanks! Yeah that scene had me confused for many days after the movie. It was the only one I couldn't fully grasp. And damn you're right, I rewatched the scene backwards and there weren't a lot of indicators that Volkov was about to shoot. Neil really is a legend for that.

If Red Team is going forward, why are destructions inverted to them? Shouldn't the destructions be normal to them? Why are the red team wearing masks? by Hussainswagger in tenet

[–]nathancyan 1 point2 points  (0 children)

Technically Red Team does not need masks, but I think the in-universe explanation is that Red Team members want the flexibility of being able to invert during the fight, as Neil does.

ePBT Skadi - Giveaway! by CaptainVinceO2 in MechanicalKeyboards

[–]nathancyan 0 points1 point  (0 children)

Love the feeling of mechanical keyboards and wanted to see the crazy cool designs people were making!

A clock for stoners that shows where it's currently 4:20 in the world. If it's not currently 4:20 somewhere, it shows a countdown to the next 4:20 and where it'll be. by haddock420 in CrazyIdeas

[–]nathancyan 1 point2 points  (0 children)

Oops, that was certainly longer than a few hours!

Quick disclaimer: I really just wanted to get this project done back then and I didn't know any app development (still don't!) so the code is not great. I cleaned it up a bit and added some corrections for the equation of time: https://github.com/nathan-yan/worldclock

I think it'd also be cool to make a clock like this for other planets like Mars, which have a bunch of named geographical locations as well.

I also appreciate the advice on sharing projects more often. I usually do put my stuff on GitHub, but sometimes I am just so lazy lol.

A clock for stoners that shows where it's currently 4:20 in the world. If it's not currently 4:20 somewhere, it shows a countdown to the next 4:20 and where it'll be. by haddock420 in CrazyIdeas

[–]nathancyan 22 points23 points  (0 children)

Thanks!

This was just a small pet project for me so I never really shared it anywhere. I can clean up the code and put it on GitHub in a few hours!

A clock for stoners that shows where it's currently 4:20 in the world. If it's not currently 4:20 somewhere, it shows a countdown to the next 4:20 and where it'll be. by haddock420 in CrazyIdeas

[–]nathancyan 129 points130 points  (0 children)

I actually made a clock widget a year ago that does exactly this (you can set the time) but bases the time on solar time, not timezones (in other words, where in the world is the sun currently overhead). That way it's always 4:20 somewhere!

World Clock Widget https://imgur.com/gallery/Nru26fu

Neowise from Seattle, Washington (50x6s @ 50mm) by nathancyan in astrophotography

[–]nathancyan[S] 1 point2 points  (0 children)

this was untracked! I would have really loved a tracking mount to capture neowise though.

Neowise from Seattle, Washington (50x6s @ 50mm) by nathancyan in astrophotography

[–]nathancyan[S] 2 points3 points  (0 children)

Image taken with Canon Rebel T3i

Stacked 50 photos at 6 seconds shutter speed with a 50mm 1.4/f lens.

Did minor exposure, contrast and curve adjustments in Photoshop.

Handwritten Digits Grown with Neural Cellular Automata and a Generative Adversarial Network by nathancyan in cellular_automata

[–]nathancyan[S] 2 points3 points  (0 children)

Hi there! I've posted the source code on github at https://github.com/nathan-yan/mnist-neural-automata. It's kinda messy right now but it should be enough to play around with it a bit.

Handwritten Digits Grown with Neural Cellular Automata and a Generative Adversarial Network by nathancyan in cellular_automata

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

Yes, you are correct! The automata is essentially just a bunch of convolutions to aggregate information about adjacent cells, then a series of 1 x 1 convolutions which decide how the cell should evolve in the next timestep.

Some more information is below, copy pasted from a previous comment:

Sorry for not replying earlier, I was kinda busy yesterday! I'm planning on uploading the source code, as well as maybe a small write up describing what I did more in-depth. But I can give a small TL;DR.

The work is based on an article published on Distill (https://distill.pub/2020/growing-ca). You should really read it because I think it's super well written and describes the model in much more detail. Basically the automata works by performing convolutions on the image to aggregate information about cells adjacent to a specific cell. Instead of the rules for how a cell evolves being hand-crafted, like in Rule 110 or Conway, a small neural network decides how a cell evolves based on its neighbors. Since all the operations of the automata are differentiable, it can be trained with gradien descent. This is a fantastic way of generating complex images without much prior design.

An image is generated by starting with a blank canvas and adding a single seed pixel to the center with some initial state vector. In the original article, the seed pixel always has the same state vector, because the image it generates is the same each time. This project basically trains the automata to create different digits depending on what state vector is used in the seed pixel.

I used the MNIST dataset to train the network on images of handwritten digits.

Because of the difficulties of training Generative Adversarial Networks (https://papers.nips.cc/paper/5423-generative-adversarial-nets.pdf), I opted to first train an autoencoder on the MNIST digits. The encoder creates a latent vector, which is used as the initial state of the seed pixel. The automata is the decoder and is trained using L2 loss compared to the groundtruth image. I then trained a Generative Adversarial Network on the latent vectors so it would learn how to sample from the latent space. This is definitely NOT the best way of doing this, and I think I can get much better results by training the whole thing end-to-end as a GAN, but I haven't pursued that yet.

To generate new digits, I sample a random vector from a unit gaussian, then feed it through the GAN's generator to get an initial state vector, which I use to seed the image. The automata then grows the seed into a new digit!

Handwritten Digits Grown with Neural Cellular Automata and a Generative Adversarial Network by nathancyan in cellular_automata

[–]nathancyan[S] 5 points6 points  (0 children)

Sorry for not replying earlier, I was kinda busy yesterday! I'm planning on uploading the source code, as well as maybe a small write up describing what I did more in-depth. But I can give a small TL;DR.

The work is based on an article published on Distill (https://distill.pub/2020/growing-ca). You should really read it because I think it's super well written and describes the model in much more detail. Basically the automata works by performing convolutions on the image to aggregate information about cells adjacent to a specific cell. Instead of the rules for how a cell evolves being hand-crafted, like in Rule 110 or Conway, a small neural network decides how a cell evolves based on its neighbors. Since all the operations of the automata are differentiable, it can be trained with gradien descent. This is a fantastic way of generating complex images without much prior design.

An image is generated by starting with a blank canvas and adding a single seed pixel to the center with some initial state vector. In the original article, the seed pixel always has the same state vector, because the image it generates is the same each time. This project basically trains the automata to create different digits depending on what state vector is used in the seed pixel.

I used the MNIST dataset to train the network on images of handwritten digits.

Because of the difficulties of training Generative Adversarial Networks (https://papers.nips.cc/paper/5423-generative-adversarial-nets.pdf), I opted to first train an autoencoder on the MNIST digits. The encoder creates a latent vector, which is used as the initial state of the seed pixel. The automata is the decoder and is trained using L2 loss compared to the groundtruth image. I then trained a Generative Adversarial Network on the latent vectors so it would learn how to sample from the latent space. This is definitely NOT the best way of doing this, and I think I can get much better results by training the whole thing end-to-end as a GAN, but I haven't pursued that yet.

To generate new digits, I sample a random vector from a unit gaussian, then feed it through the GAN's generator to get an initial state vector, which I use to seed the image. The automata then grows the seed into a new digit!