How do you predict future value?

0

I'm making a calculator for FPS games , and in it, you enter the number of Kills , and the number of Deaths . So far so good, I was able to make the command line for her to take the two values, and set the percentage, but at the time of the forecast is that I lose. I'm starting now with C # programming and I do not know what to use.

int kill, death;
double valor, KD_Porcentagem; 

valor = kill + death; //É SOMADO OS VALORES TOTAIS  
KD_Porcentagem = (kill * 100) / valor;//MULTIPLICADO O REQUERIDO POR 100, E DIVIDIDO PELA SOMA

Simple, I simply did rule three, putting that value equal to 100% and that kill is equal to KD_Porcentage. I tried to do the same, but it did not work. I am based on a calculator with the same scheme, and same idea, in which the following happens:

To kill = 90

and death = 30

KD_Power = 75%

In the forecast, the following occurs:

Forecast:

Kill / Death 76%: Kill less Death in the period has to be: 3

Kill / Death 77%: Kill less Death in the period has to be: 8

Kill / Death 78%: Kill less Death in the period has to be: 14

Kill / Death 79%: Kill less Death in the period has to be: 20

I've tried everything already, but I can not figure anything out ... Could you help?

    
asked by anonymous 07.11.2014 / 13:48

2 answers

1

Nothing that lists and rule 3 does not solve ... Our math friend will help us in this ...

You can do in various ways ... average or sum of daily kills / deaths ... and make a projection of these values against a base (games won / hours played /% improvement per game) ... yes yes you have a prediction increasing or decreasing.

If it is a game that earn XP / Level ... it would be even more interesting ... because you would inform the current value of xp gain ... and it will make a projection of when you reached a certain level

I would do it this way ...

//criando nossa classe de dados
public class Dado
{
  Datetime datahora { get; set; }
  int kills { get; set; }
  int deaths { get; set; }
}

//criando uma lista desses dados...
//apos inserir varias essa lista contera varios dados... entao voce pode começar a brincar com eles... com alguns foreachs e if...

//instanciando a lista
List<Dado> ListaDados = new List<Dado>();

//instanciando um dado
Dado d = new Dado();
d.datahora = DateTime.Now();
d.kills = 120;
d.deaths = 60;

//adicionando o dado na lista...
ListaDados.Add(d);

Now your list has a data ... you can show this list in a DataGridView (using windows forms) ...

DGV.DataSource = ListaDados.ToList();

And we can walk on this list and do some mathematical accounts ... as a kills average for example ...

int totalelementoslista = ListaDados.Count;
int killstotais = 0;
int mortestotais = 0;
foreach (Dado d in ListaDados)//percorrendo a lista de dados
{
    killstotais += d.kills;
    mortestotais += d.deaths;
    int mediakillsdessejogo = d.kills / d.deaths; //ai voce guarda em algum outro lugar se quiser
}

    int mediakills = killstotais / mortestotais; // voce tem a media de kills de todos os jogos juntos.

UPDATE: You explained a little your need ... would be to create a future projection of kills / deaths for a percentage ... and this is very easy to do ... Create a new data list ... and generate it using a for ... generating values in this list using math. you will have the data inside it ... everything right you can put it in a curve graph ... and it will be well show!

    
07.11.2014 / 14:45
1

daniloloko's answer is correct, but I think it could be simplified.

The answer goes down for forecasts in the next 5 percentages. Mathematics

PARA AUMENTAR EM UM A PORCENTAGEM É NECESSÁRIO
100(X+killinicial)/killinicial+deathinicial+X = porcentagem+1
100x+100killinicial/valorinicial+x=porcentagem+1
100x+100killinicial=(valorinicial+x)(porcentagem+1)
100x+100killinicial=valorinicial*(porcentagem+1)+x*(porcentagem+1)
100x-x*(porcentagem+1)=valorinicial*(porcentagem+1)-100killinicial
x=(valorinicial*(porcentagem+1)-100killinicial)/(100-porcentagem+1)

Your code

    int kill, death,x;
double valor, KD_Porcentagem; 

valor = kill + death; //É SOMADO OS VALORES TOTAIS  
KD_Porcentagem = (kill * 100) / valor;//MULTIPLICADO O REQUERIDO POR 100, E DIVIDIDO PELA SOMA
KD_porcentagem = KD_Porcentagem % 100// PEGA SÓ A PARTE INTEIRA. FACILITANDO NOSSA VIDA.
x=((valor*(KD_Porcentagem+1))-100*kill)/(100-KD_Porcentage+1)

In your example you had:

To kill = 90

and death = 30

KD_Power = 75%

value: 120

by my formula

x = (120 * 76) -9000/24 x = 5

This shows that your example is wrong because: in this new example we have k-95 D-30 value 125 9500/125 = 76%

By completing your code you make a for as many times as you like and only reassign the values. if you do not want to lose the values of kill and death use Backup variables.

Your code with the 5 outputs:

        int kill, death,x;
double valor, KD_Porcentagem; 


valor = kill + death; //É SOMADO OS VALORES TOTAIS  
KD_Porcentagem = (kill * 100) / valor;//MULTIPLICADO O REQUERIDO POR 100, E DIVIDIDO PELA SOMA
//mostra a porcentagem atual com kill death.

//faz a previsão
for(int y=0;y<5;y++)
{
   valor = kill + death; //É SOMADO OS VALORES TOTAIS  
   KD_Porcentagem = (kill * 100) / valor;//MULTIPLICADO O REQUERIDO POR 100, E DIVIDIDO PELA SOMA
   KD_porcentagem = KD_Porcentagem % 100// PEGA SÓ A PARTE INTEIRA. FACILITANDO NOSSA VIDA.
   x=((valor*(KD_Porcentagem+1))-100*kill)/(100-KD_Porcentage+1);
   //mostra x
   kill=kill+x;
}
    
13.11.2014 / 12:10