Distribute gold among items depending on demand

  • I
  • Thread starter Addez123
  • Start date
  • Tags
    Gold
In summary: It should be 150% of whatever b.demand + c.demand equals right? Considering you have 10, want to allocate 6 of that to a, leaving the other two some combination that equals 4. 6 is 150% of 4, do that is the answer? I'm not to great at math either tbh, but I have a very similar problem like this i am trying to code as it relates to a game also. It had to do with classifying different tasks based in their averaged...
  • #1
Addez123
199
21
TL;DR Summary
I have a table of items.
Each item has a
- demand, representing how many items has been sold
- desiredPrice: Given defaultDemand, the price should equal desiredPrice

There's a pot of gold that should be distributed among all items.
Items with high demand should receive LESS gold, and items with little demand should receive MORE gold.

The total gold in the pot equals the sum of all desiredPrice's among the items.

How do I calculate the price from demand?
How do I calculate defaultDemand?
This turned out to be more difficult than I thought!

Right now my calculations for the price for each item:
price = (1 - demand/totalDemand) * goldToDistribute

It doesn't work, example case:
goldToDistribute = 10

a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200
a.price = (1 - 10/200)* 10 = 9.5
b.price = (1 - 90/200)* 10 = 5.5

already here we can see we've distributed 15gold when we only had 10 gold to distribute.
What would be a better function for price?

Basically what I'm looking for is a solution to
price = f(demand, totalDemand, goldToDistribute)
 
Mathematics news on Phys.org
  • #2
Addez123 said:
Summary: I have a table of items.
Each item has a
- demand, representing how many items has been sold
- desiredPrice: Given defaultDemand, the price should equal desiredPrice
In your example, you show only the demand and a price, but not the desired price.
Addez123 said:
There's a pot of gold that should be distributed among all items.
Items with high demand should receive LESS gold, and items with little demand should receive MORE gold.

The total gold in the pot equals the sum of all desiredPrice's among the items.

How do I calculate the price from demand?
How do I calculate defaultDemand?

This turned out to be more difficult than I thought!

Right now my calculations for the price for each item:
price = (1 - demand/totalDemand) * goldToDistribute

It doesn't work, example case:
goldToDistribute = 10

a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200
a.price = (1 - 10/200)* 10 = 9.5
b.price = (1 - 90/200)* 10 = 5.5

already here we can see we've distributed 15gold when we only had 10 gold to distribute.
What would be a better function for price?

Basically what I'm looking for is a solution to
price = f(demand, totalDemand, goldToDistribute)
What is the DesiredPrice? What is DefaultDemand? Is your task to come up with a formula for price?

It seems like there is a lot of information that is missing. If this is a textbook problem, what is the exact problem statement?
 
  • Like
Likes FactChecker
  • #3
Mark44 said:
In your example, you show only the demand and a price, but not the desired price.

What is the DesiredPrice? What is DefaultDemand? Is your task to come up with a formula for price?

It seems like there is a lot of information that is missing. If this is a textbook problem, what is the exact problem statement?
I'm also interested in this question... for non homework reasoning.

I believe the desired price he's looking for is not a number, rather a percentage. The desired price is 100% of what it demands at the default demand. He then gives demand for each item, but at 200%. Indicating its twice the amount of available currency, which is 10.

Should not you cancel the 200% into 100% by halfing the values of...x(??) Then split the 10 gold to the three items based on what percentage of the 100% each is.
 
  • #4
Mark44 said:
What is the DesiredPrice? What is DefaultDemand? Is your task to come up with a formula for price?
So it's a coding problem for a game I do on my spare time.

desiredPrice could be any number. It's irrelevant to the equation but it's calculated based on the time it takes to obtain said item.

Default demand is what I need to calculate.
Basically, if I set the demand of every item to defaultDemand, then the price should end up being our desiredPrice.

Mark44 said:
Is your task to come up with a formula for price?
Yes. And after that a formula to calculate defaultDemand based on the price formula.
 
  • #5
zeanah said:
Should not you cancel the 200% into 100% by halfing the values of...x(??) Then split the 10 gold to the three items based on what percentage of the 100% each is.

Changing the formula to
price = (1 - demand/totalDemand) * goldToDistribute * 100/totalDemand
works for this example but doesn't work if c = 200
 
  • #6
Basically you can calculate the price through this process:a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200

a.stake = 1 - a.demand/totalDemand
b.stake = ...

totalStake = a.stake + b.stake + c.stake

a.price = a.stake/totalStake * goldToDistribute

But if I use this approach I have no way of calculating defaultDemand.
For example, what should a.demand be in order to get a.price = 6?
 
  • #7
Addez123 said:
Basically you can calculate the price through this process:a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200

a.stake = 1 - a.demand/totalDemand
b.stake = ...

totalStake = a.stake + b.stake + c.stake

a.price = a.stake/totalStake * goldToDistribute

But if I use this approach I have no way of calculating defaultDemand.
For example, what should a.demand be in order to get a.price = 6?
It should be 150% of whatever b.demand + c.demand equals right? Considering you have 10, want to allocate 6 of that to a, leaving the other two some combination that equals 4. 6 is 150% of 4, do that is the answer? I'm not to great at math either tbh, but I have a very similar problem like this i am trying to code as it relates to a game also. It had to do with classifying different tasks based in their averaged gold/second return and comparing.. Yada yada
 

FAQ: Distribute gold among items depending on demand

How does demand affect the distribution of gold among items?

The distribution of gold among items is directly influenced by demand. Items that are in high demand will receive a larger portion of the gold, while items with lower demand will receive a smaller portion. This is done to incentivize players to obtain and use items that are in high demand, balancing the game economy.

What factors determine the demand for certain items?

The demand for items can be influenced by a variety of factors, including their rarity, usefulness in gameplay, and popularity among players. In-game events, updates, and changes in gameplay can also impact the demand for certain items.

How is the amount of gold distributed among items determined?

The amount of gold distributed among items is typically determined by game developers or a game economy team. They take into account the demand for each item, as well as other factors such as the item's rarity and value in gameplay, to determine a fair and balanced distribution of gold.

Is the distribution of gold among items a fixed system or does it change over time?

The distribution of gold among items can vary over time, especially in online games that receive regular updates and changes. As demand for certain items fluctuates, the distribution of gold among them may also change to maintain balance in the game economy.

How does the distribution of gold among items affect the overall game economy?

The distribution of gold among items plays a crucial role in the overall game economy. By balancing the distribution based on demand, it can help regulate the prices of items and prevent inflation. It also encourages players to engage in gameplay and obtain items that are in high demand, keeping the game economy active and healthy.

Similar threads

Replies
8
Views
2K
2
Replies
67
Views
12K
Replies
4
Views
7K
Replies
25
Views
7K
Replies
5
Views
3K
Replies
4
Views
6K
Back
Top