Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 171 172 [173]

Author Topic: Mathematics Help Thread  (Read 195319 times)

JoshuaFH

  • Bay Watcher
    • View Profile
Re: Mathematics Help Thread
« Reply #2580 on: April 04, 2024, 06:10:41 pm »

I've gotten into Helldivers 2. It has these things called stratagems which are air strikes and stuff you can call down. To do that you need to input a combination of up, down, left, and right. There are something like 20 or 30 stratagems in the game, but it occurred to me that the devs have a serious developmental problem: there's only so many unique combinations you can have without any of them overlapping. The stratagems cannot overlap, or players won't be able to bring both at the same time. It seems like a math problem, but I have no clue how I'd even get started on it, and considering my post on the Helldivers 2 Reddit got instantly deleted for being a "trivial question" I'm not sure who else I'd bring the question to but here.

Not important, just really curious.
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: Mathematics Help Thread
« Reply #2581 on: April 04, 2024, 06:19:46 pm »

If you have no limit on how many inputs are required for a strategem you can make it so you never run out of combinations. If you have a limited number of inputs you can figure out the maximum number of unique combinations: it's 4 to the power of the number of inputs.

By the way, a correspondence between combinations of characters and items you want to convey such that no combination is a prefix of another is called a Huffman encoding. There is a way to make such an assignment based on how often you use each item to minimize the average number of characters used to describe items.
« Last Edit: April 04, 2024, 06:28:42 pm by bloop_bleep »
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Ulfarr

  • Bay Watcher
  • Going on a pilgrimage to Mars
    • View Profile
Re: Mathematics Help Thread
« Reply #2582 on: April 05, 2024, 04:03:45 am »

The closest analog I can think are the codons (genetic code) where you have four "bases" A, G, C, U (for dna) and they are combined in groups of 3, resulting in 64 different combinations (4^3 = 64).

In a similar vein if the helldivers startegems use groups of four then there are already 4^4=256 different combinations. I guess that should be more than enough for the entire game.
Logged
Bring Kobold Kamp to LNP! graphics compatibility fix.

So the conclusion I'm getting here is that we use QSPs because dwarves can't pilot submarines.

JoshuaFH

  • Bay Watcher
    • View Profile
Re: Mathematics Help Thread
« Reply #2583 on: April 16, 2024, 03:37:37 pm »

If you have no limit on how many inputs are required for a strategem you can make it so you never run out of combinations. If you have a limited number of inputs you can figure out the maximum number of unique combinations: it's 4 to the power of the number of inputs.

By the way, a correspondence between combinations of characters and items you want to convey such that no combination is a prefix of another is called a Huffman encoding. There is a way to make such an assignment based on how often you use each item to minimize the average number of characters used to describe items.

There is a limit. (Sorry to get back to this so much later). For most stratagems, that's 6. And the minimum seems to be 3. I'm not sure how to go about this huffman encoding, but googling it, it seems to be a method of compression?
Logged

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: Mathematics Help Thread
« Reply #2584 on: May 18, 2024, 03:46:17 am »

Not really help, just a curiosity. At first I thought it was just a coincidence, but now I've nerd-sniped myself.

How many square-free integers a>1 exist such that the cube of a, and the squares nearest to that cube, are separated by the square roots of the other squares?

By that I mean, is there a natural number b such that a3 - b2 = b+1 and (b+1)2 - a3 = b, or alternatively, a3 - (b+1)2 = b and b2 - a3 = (b+1)? Let's call the first set of conditions H, and the alternative set of conditions G.

All I've been able to deduce is that H implies 4a3-3 must be a square number, and G is impossible since it implies b = (√(4a3+5)+1)/2 and b = (√(4a3+5)-3)/2, which results in 1/2 = -3/2.

Other than that, 7 is the only one of the square-free integers from the list on OIES that satisfies H (73 - 182 = 19 and 192-73 = 18). In fact, I've checked all square-free integers below ten million with some Python code, and 7 is the only one of those that satisfies H.

Considering the problem and the necessary conditions are so simple, I'm surprised there are no other examples. Am I too blind to see something obvious?
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.

Magmacube_tr

  • Bay Watcher
  • Praise KeK! For He is The Key and The Gate!
    • View Profile
Re: Mathematics Help Thread
« Reply #2585 on: May 18, 2024, 06:14:17 am »

What is 6 x 3?
Logged
I must submerge myself in MAGMAAAAAAAAA! daily for 17 cents, which I detest. With a new profile picture!

My gaem. JOIN NAOW!!!

My sigtext. Read if you dare!

zhijinghaofromchina

  • Bay Watcher
  • I am a fan of 矮人要塞
    • View Profile
Re: Mathematics Help Thread
« Reply #2586 on: May 18, 2024, 10:43:41 am »

根据乘法表口诀,三六一十八, so, I guess 3*6=18
Logged
人生在世不称意 明朝散发弄扁舟

NJW2000

  • Bay Watcher
  • You know me. What do I know?
    • View Profile
Re: Mathematics Help Thread
« Reply #2587 on: Today at 01:02:12 pm »


By that I mean, is there a natural number b such that a3 - b2 = b+1 and (b+1)2 - a3 = b, or alternatively, a3 - (b+1)2 = b and b2 - a3 = (b+1)? Let's call the first set of conditions H, and the alternative set of conditions G.

Very interesting question. I'd like to see the python code too, mine was rubbish and chugged the laptop hard when checking a up to 10,000.

Had a look at this but haven't made much progress on the why of it. I'm not a number theorist though. Here's a few things:

Facts about squares tell us that the first part of H is enough, i.e. a^3 = b^2 + b + 1 means that a^3 + b is (b+1)^2.

Wolfram gave me 4 integer solutions for a^3 - b^2 - b - 1 = 0 , but the other 3 rely on negative or 0 a or b.

I think you can just reformulate the problem as: 4 a^3 = k^2 +3 for some integers a,k, but I don't know why that only has the 4 integer solutions.



You're right that G is impossible for positive integer a and b. There's a nice way of seeing why:

Quote
suppose G holds for some integer a, b

Then a^3 = b (b+1)

b and b+1 share no common factors... so must be cubes of integers themselves, as otherwise a would not be a cube.

The only integer cubes with a difference of 1 are -1, 0 and 1. So we obtain b=0 or b+1 = 0, so a=0 and b=-1 or b=0

Would love to see other people chime in on this, but I'd advise you to check if it's a case of an unsolved problem in number theory before getting too invested. There's a lot of those, and some can be stated very simply.
Logged
One wheel short of a wagon
Pages: 1 ... 171 172 [173]