User Tools

Site Tools


gamemanual:gm_stocks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gamemanual:gm_stocks [2022/06/14 12:32] – [IPO Evaluation] admingamemanual:gm_stocks [2022/06/20 13:57] (current) – [Variables] admin
Line 1: Line 1:
 +======= Stocks Game Mechanics =======
  
 +
 +The Game Mechanics section of the manual details the internal formula used in the game's calculations.  This section of the manual uses pseudo-code and may not be 100% the same as the code in the game. 
 +
 +The Game Mechanics part of the manual is mainly designed to be a reference for the frequently asked question, "Why do I get this rating when I do X, Y, Z?!" Usually, this answer involves many different variables, which this section of the manual demonstrates. 
 +
 +**The game mechanics section of the manual shows [[https://idioms.thefreedictionary.com/seeing+how+the+sausage+gets+made|how the sausage gets made]]. So you really may want to avoid this portion of the manual if you enjoy the game.** 
 +
 +
 +====== Variables ======
 +
 +^ Name ^ Description ^ ^ Name ^ Description ^
 +| **Money** | Amount of cash your company has | | **Total_Debt** | Total Debt including all Loans, Bond Par Values, and Line Of Credit | 
 +| **Branch_Construction_Costs** | Total value of all branch construction | | **Factory_Construction_Costs** | Total value of all completed factory construction | 
 +| **Vehicle_Inventory** | Vehicle inventory times the average unit costs of the vehicles | | **Total_Design_Costs** | Design costs of all your components and vehicles divided by 10 | 
 +| **Share_Holdings** | The value of other company shares you own | | **Global_Stock_Rate** | Global Stock Rate as defined by the TurnEvents.xml file  | 
 +| **Revenues_12_Months** | Revenues over the last 12 months | | **GameStartYear** | The year you started the game | 
 +| **Evaluation** | Price Evaluation defined in the Price Evaluation section | | **EPS_Growth** | Change in EPS rating over the last year | 
 +| **Total_Shares** | The total number of issued shares | | **CurrentSharePrice** | Share price for the previous month | 
 +| **Last_EPS** | Last Quarter's EPS | | **Current_EPS** | This Quarter's EPS | 
 +| **EPS_Q#** | EPS from # quarters ago | | **Delisted** | No longer publically traded | 
 +| **LY_YTD_Profits** | Last Year Total Profits | | **CurrentFunds** | Current amount of money the company has | 
 +| **Turn_Expenses** | Last Month's Expenses | | **Turn_Income** | Last Month's Revenues | 
 +| **LastYear_Expenses** | Last Year's Expenses | | **LastYear_Income** | Last Year's Revenues | 
 +| **Current_Construction_Costs** | All current expenses from factory construction | | **** |  | 
 +
 +
 +
 +
 +
 +====== Price Evaluation ======
 +
 +<code cpp>   
 +Money - Total_Debt + Branch_Construction_Costs +
 +Factory_Construction_Costs + Vehicle_Inventory + 
 +Total_Design_Costs + Share_Holdings
 +</code>
 +
 +
 +====== IPO Evaluation ======
 +
 +<code cpp>
 +
 +PriceEvaluation =  PriceEvaluation/2.0 + ((PriceEvaluation/2.0) * Global_Stock_Rate)
 +
 +PriceEvaluation = PriceEvaluation * 1.2 + (Revenues_12_Months * (3 * Global_Stock_Rate))
 +
 +IPO_Share_Price = 10
 +
 +Shares_Issued = PriceEvaluation / IPO_Share_Price
 +</code>
 +
 +
 +====== Share Price ======
 +
 +<code cpp>
 +
 +if(Year > 2000)
 +{
 +    if(Year-GameStartYear > 8 )
 +        NewSharePrice  = ((Evaluation*0.4) + (Revenues_12_Months*1.0*Global_Stock_Rates) *
 +                (0.75 * EPS_Growth)) / (Total_Shares);
 +    else
 +    {
 +        NewSharePrice  = ((Evaluation*(0.4+((8-(Year-GameStartYear))*0.1))) +
 +            (Revenues_12_Months*1.0*Global_Stock_Rates) *
 +            (((Year-GameStartYear)*0.1) * EPS_Growth)) / (Total_Shares);
 +    }
 +}
 +else
 +{
 +    if(Year-GameStartYear > 8 )
 +        NewSharePrice  = ((Evaluation*0.4) + (Revenues_12_Months*(10.0-((Year-1900)/10))*
 +            Global_Stock_Rates) *(0.75 * EPS_Growth)) / (Total_Shares);
 +    else
 +    {
 +        NewSharePrice  = ((Evaluation*(0.4+((8-(Year-GameStartYear))*0.1))) +
 +            (Revenues_12_Months*(10.0-((Year-1900)/10))*Global_Stock_Rates) *
 +            (((Year-GameStartYear)*0.1) * EPS_Growth)) / (Total_Shares);
 +    }
 +}
 +
 +
 +
 +
 +NewSharePrice = CurrentSharePrice +
 +    ( ((NewSharePrice - CurrentSharePrice) / 3.5) +
 +    ((((NewSharePrice - CurrentSharePrice) / 3.0)) -
 +    (NewSharePrice - CurrentSharePrice) / 6.0) )
 +
 +if(NewSharePrice < 0)
 +    NewSharePrice = 0.01;
 +
 +if(A Quarter Month)
 +{
 +    if(Last_EPS > 0)
 +    {
 +        if(Current_EPS > Last_EPS * 2.0)
 +            NewSharePrice = NewSharePrice * 1.15; 
 +        else if(Current_EPS > Last_EPS * 1.2)
 +            NewSharePrice = NewSharePrice * 1.1; 
 +        else if(Current_EPS > Last_EPS * 1.1)
 +            NewSharePrice = NewSharePrice * 1.05; 
 +        else if(Current_EPS < Last_EPS * 0.9)
 +            NewSharePrice = NewSharePrice * 0.95; 
 +        else if(Current_EPS < Last_EPS * 0.8)
 +            NewSharePrice = NewSharePrice * 0.85; 
 +        else if(Current_EPS < Last_EPS * 0.7)
 +            NewSharePrice = NewSharePrice * 0.75;
 +    }
 +    else if(Last_EPS < 0)
 +    {
 +        if(Current_EPS > Last_EPS * 0.7)
 +            NewSharePrice = NewSharePrice * 1.15;
 +        if(Current_EPS > Last_EPS * 0.8)
 +            NewSharePrice = NewSharePrice * 1.1;
 +        if(Current_EPS > Last_EPS * 0.9)
 +            NewSharePrice = NewSharePrice * 1.05;
 +        else if(Current_EPS < Last_EPS * 1.1)
 +            NewSharePrice = NewSharePrice * 0.95;
 +        else if(Current_EPS < Last_EPS * 1.2)
 +            NewSharePrice = NewSharePrice * 0.85;
 +        else if(Current_EPS < Last_EPS * 1.3)
 +            NewSharePrice = NewSharePrice * 0.75;
 +    }
 +    else if(Last_EPS == 0)
 +    {
 +        if(Current_EPS > Last_EPS )
 +            NewSharePrice = NewSharePrice * 1.05;
 +        else if(Current_EPS < Last_EPS )
 +            NewSharePrice = NewSharePrice * 0.95;
 +        else if(Current_EPS == 0 && Last_EPS == 0 && eps3 == 0 && eps4 == 0)
 +        {
 +            NewSharePrice = NewSharePrice * (Random Number Between (0 AND 0.2) + 0.95);
 +        }
 +
 +    }
 +
 +}
 +
 +if(NewSharePrice < ((Evaluation * 0.7) / Total_Shares))
 +{
 +    NewSharePrice = ((Evaluation * 0.7) / Total_Shares);
 +}
 +
 +
 +
 +if(CurrentSharePrice != 0)
 +{
 +    priceChange = NewSharePrice / CurrentSharePrice;
 +}
 +
 +
 +
 +
 +</code>
 +
 +
 +
 +
 +====== Share Splits ======
 +
 +
 +===== Split =====
 +
 +<code cpp>
 +
 +if(NewSharePrice>(30+((Year-1899)*2)) OR 
 +(((EPS_Q1+EPS_Q2+EPS_Q3+EPS_Q4)>(4+((Year-1899)/3))) AND NewSharePrice > 5) )
 +{
 +    NewSharePrice = NewSharePrice / 2.0;
 +    TotalShares = TotalShare * 2;
 +    
 +}
 +</code>
 +
 +===== Reverse Split =====
 +
 +<code cpp>
 +if(NewSharePrice < 1)
 +{
 +
 +    if(TotalShares / 2 > 1000)
 +    {
 +        TotalShares = TotalShares / 2;
 +        NewSharePrice = NewSharePrice * 2;
 +    }
 +    else
 +    {
 +        Delisted     
 +    }
 +
 +}
 +
 +</code>
 +====== Takeover Price ======
 +
 +<code cpp>
 +if(Shares_Needed > 0)
 +{
 +    if(EPS_Year < -0.5)
 +    {
 +            AqusitionCosts = ((((Price_Evaluation*1.1)/(Shares_Needed)/5) +
 +             (PricePerShare*1.3)) * Shares_Needed)*DifficultyBonus ;
 +
 +    }
 +    else
 +    {        
 +            AqusitionCosts = ((((Price_Evaluation*1.2)/(Shares_Needed)/2.5) +
 +                (PricePerShare*1.75)) * Shares_Needed) * ((EPS_Year/10.0) + 1)*DifficultyBonus;       
 +
 +    }
 +
 +    PricePerShare = (AqusitionCosts / (Shares_Needed));
 +}
 +else
 +    AqusitionCosts = ((Price_Evaluation/10))*DifficultyBonus;
 +
 +</code>
 +
 +
 +
 +====== AI Buy/Sell Shares ======
 +
 +
 +===== Institutional =====
 +
 +==== Buy ====
 +
 +<code cpp>
 +if(priceChange > 7%)
 +    Buy 10% of the available shares.
 +else if(priceChange > 4%)
 +    Buy 7% of the available shares.
 +else if(priceChange > 0% AND Random Number Between (0 AND 4) = 0)
 +    Buy 3.5% of the available shares.
 +</code>
 +
 +==== Sell ====
 +
 +<code cpp>
 +if(priceChange < -10% AND Random Number Between (0 AND 12) = 0)
 +    Sell 4% of shares owned.
 +else if(priceChange < 0.95 AND Random Number Between (0 AND 12) = 0)
 +    Sell 2.5% of shares owned.
 +else if(Random Number Between (0 AND 12) = 0)
 +    Sell 1% of shares owned.
 +</code>
 +
 +
 +
 +===== AI Companies =====
 +
 +==== Buy ====
 +
 +<code cpp>
 +if(LY_YTD_Profits > 0 && CurrentFunds > (LY_YTD_Profits*2) )
 +    Buy 10% of CurrentFunds worth of stock shares.
 +</code>
 +
 +
 +==== Sell ====
 +
 +<code cpp>
 +
 +
 +IF (( CurrentFunds < ( (Turn_Expenses-Turn_Income) * 3 )  AND 
 + CurrentFunds < (LastYear_Expenses - LastYear_Income) ) OR 
 + CurrentFunds < (Turn_Expenses-Current_Construction_Costs-Turn_Income))
 +{
 +    if( Company owns more than 25% of self )
 +        Sell 5% of shares owned of their company.
 +    else
 +        Sell all shares of random company.
 +}
 +  
 +</code>