Jump to content

I am a new coder... i have done a substantial amount of research and cant seem to find an answer.

in the code below, when i have the head-shot percentage print. it is ALWAYS 0% and I cant seem to find out why. Any suggestions?

 

The ENTIRE code (the information you need is toward the bottom):

 

/////////////////////////////////////////////////////////////////////// Weapon Kill definiton(s)

//Pistol Kill Variable(s)
#define USPSkill ak1
#define P2000kill ak2
#define GLOCK18kill ak3
#define DUEL_BERRETASkill ak4
  #define DULIESkill DUEL_BERRETASkill
#define P250kill bk1
//#define p228kill // 1.6, CSS
#define CZ75kill bk2
#define FIVESEVENkill ck1
#define TEC9kill ck2
#define DESERT_EAGLEkill dk1
  #define DEAGLE DESERT_EAGLEkill
#define R8_REVOLVERkill ak5
  #define REVOLVERkill R8_REVOLVERkill
  
//SMG Kill Variable(s)
#define MAC10kill ak6
#define MP9kill ak7
//#define TMPkill // 1.6, CSS
#define MP7kill ak8
//#define MP5kill // 1.6, CSS
#define UMP45kill bk3
#define P90kill ck3
#define PPBIZONkill ak9
  #define BIZONkill PPBIZONkill

//Rifle Kill Variable(s)
#define FAMASkill ak10
#define GALILARkill ak15
  #define GALILkill GALILARkill
#define AK47kill bk4
#define M4A1Skill bk5
#define M4A4kill bk6
#define AUGkill ck4
#define SG553kill ck5
  #define SGkill SG553kill
//#define SG552kill // 1.6, CSS

//Sniper Kill Variable(s)
#define SSG08kill dk2
  #define SCOUTkill SSG08kill
  #define SSGkill SSG08kill
#define AWPkill dk3
#define SCAR20kill ck6
  #define CT-AUTOkill
#define G3SG1kill ck7
  #define T-AUTOkill G3SG1
  
//Shotgun Kill Variable(s)
#define MAG7kill ak11
#define SAWEDOFFkill ak12
#define XM1014kill ak13
  #define AUTOSHOTTYkill XM1014
#define NOVAkill ak14
//#define BENELLI_M3kill // 1.6, CSS

//LMG Kill Variable(s)
#define M249kill ck8
#define NEGEVkill ck9

//Other (Weapon) Kill Variable(s)
#define GRENADEkill dk4 //Expand in the future ie HE, Flash, Decoy, Etc
#define KNIFEkill dk5

/////////////////////////////////////////////////////////////////////// Weapon Kill Sums

#define ak ak1+ak2+ak3+ak4+ak5+ak6+ak7+ak8+ak9+ak10+ak11+ak12+ak13+ak14 //ak 1-14
#define bk bk1+bk2+bk3+bk4+bk5+bk6 //bk 1-6
#define ck ck1+ck2+ck3+ck4+ck5+ck6+ck7+ck8+ck9 //ck 1-9
#define dk dk1+dk2+dk3+dk4+dk5//dk 1-5

#define KTotal ak+bk+ck+dk//Counts Total of Kills

/////////////////////////////////////////////////////////////////////// Weapon Kill Integer(s)

//Pistol Kill Integer(s)
int USPSkill = ak1 ; 
int P2000kill = ak2 ; 
int GLOCK18kill = ak3 ; 
int DUEL_BERRETASkill = ak4 ; 
int P250kill = bk1 ; 
//int p228kill = // 1.6, CSS
int CZ75kill = bk2 ; 
int FIVESEVENkill = ck1 ; 
int TEC9kill = ck2 ; 
int DESERT_EAGLEkill = dk1 ; 
int R8_REVOLVERkill = ak5 ; 
  
//SMG Kill Integer(s)
int MAC10kill = ak6 ; 
int MP9kill = ak7 ; 
//int TMPkill = // 1.6, CSS
int MP7kill = ak8 ; 
//int MP5kill = // 1.6, CSS
int UMP45kill = bk3 ; 
int P90kill = ck3 ; 
int PPBIZONkill = ak9 ; 

//Rifle Kill Integer(s)
int FAMASkill = ak10 ; 
int GALILARkill = ak15 ;
int AK47kill = bk4 ;
int M4A1Skill = bk5 ;
int M4A4kill = bk6 ;
int AUGkill = ck4 ;
int SG553kill = ck5 ;
//int SG552kill = // 1.6, CSS

//Sniper Kill Integer(s)
int SSG08kill = dk2 ;
int AWPkill = dk3 ;
int SCAR20kill = ck6 ;
int G3SG1kill = ck7 ;

//Shotgun Kill Integer(s)
int MAG7kill = ak11 ;
int SAWEDOFFkill = ak12 ;
int XM1014kill = ak13 ;
int NOVAkill = ak14 ;
//int BENELLI_M3kill = 0// 1.6, CSS

//LMG Kill Integer(s)
int M249kill = ck8 ;
int NEGEVkill = ck9 ;

//Other (Weapon) Kill Integer(s)
int GRENADEkill = dk4 ; //Expand in the future ie HE, Flash, Decoy, Etc
int KNIFEkill = dk5 ;

/////////////////////////////////////////////////////////////////////// Weapon Assist definiton(s)

//Pistol Assist Variable(s)
#define USPSassist aa1
#define P2000assist aa2
#define GLOCK18assist aa3
#define DUEL_BERRETASassist aa4
  #define DULIESassist DUEL_BERRETASassist
#define P250assist ba1
//#define p228assist // 1.6, CSS
#define CZ75assist ba2
#define FIVESEVENassist ca1
#define TEC9assist ca2
#define DESERT_EAGLEassist da1
  #define DEAGLE DESERT_EAGLEassist
#define R8_REVOLVERassist aa5
  #define REVOLVERassist R8_REVOLVERassist
  
//SMG Assist Variable(s)
#define MAC10assist aa6
#define MP9assist aa7
//#define TMPassist // 1.6, CSS
#define MP7assist aa8
//#define MP5assist // 1.6, CSS
#define UMP45assist ba3
#define P90assist ca3
#define PPBIZONassist aa9
  #define BIZONassist PPBIZONassist

//Rifle Assist Variable(s)
#define FAMASassist aa10
#define GALILARassist aa15
  #define GALILassist GALILARassist
#define AK47assist ba4
#define M4A1Sassist ba5
#define M4A4assist ba6
#define AUGassist ca4
#define SG553assist ca5
  #define SGassist SG553assist
//#define SG552assist // 1.6, CSS

//Sniper Assist Variable(s)
#define SSG08assist da2
  #define SCOUTassist SSG08assist
  #define SSGassist SSG08assist
#define AWPassist da3
#define SCAR20assist ca6
  #define CT-AUTOassist
#define G3SG1assist ca7
  #define T-AUTOassist G3SG1
  
//Shotgun Assist Variable(s)
#define MAG7assist aa11
#define SAWEDOFFassist aa12
#define XM1014assist aa13
  #define AUTOSHOTTYassist XM1014assist
#define NOVAassist aa14
//#define BENELLI_M3assist // 1.6, CSS

//LMG Assist Variable(s)
#define M249assist ca8
#define NEGEVassist ca9

//Other (Weapon) Assist Variable(s)
#define GRENADEassist da4 //Expand in the future ie HE, Flash, Decoy, Etc
#define KNIFEassist da5

/////////////////////////////////////////////////////////////////////// Weapon Assist Sums

#define aa aa1+aa2+aa3+aa4+aa5+aa6+aa7+aa8+aa9+aa10+aa11+aa12+aa13+aa14 //aa 1-14
#define ba ba1+ba2+ba3+ba4+ba5+ba6 //ba 1-6
#define ca ca1+ca2+ca3+ca4+ca5+ca6+ca7+ca8+ca9 //ca 1-9
#define da da1+da2+da3+da4+da5//da 1-5

#define ATotal aa+ba+ca+da//Counts Total of Assists

/////////////////////////////////////////////////////////////////////// Weapon Assist Integer(s)

//Pistol Assist Integer(s)
int USPSassist = 0 ; 
int P2000assist = 0 ; 
int GLOCK18assist = 0 ; 
int DUEL_BERRETASassist = 0 ; 
int P250assist = 0 ; 
//int p228assist = // 1.6, CSS
int CZ75assist = 0 ; 
int FIVESEVENassist = 0 ; 
int TEC9assist = 0 ; 
int DESERT_EAGLEassist = da1 ; 
int R8_REVOLVERassist = aa5 ; 
  
//SMG Assist Integer(s)
int MAC10assist = 0 ; 
int MP9assist = 0 ; 
//int TMPassist = // 1.6, CSS
int MP7assist = 0 ; 
//int MP5assist = // 1.6, CSS
int UMP45assist = 0 ; 
int P90assist = 0 ; 
int PPBIZONassist = 0 ; 

//Rifle Assist Integer(s)
int FAMASassist = 0 ; 
int GALILARassist = 0 ;
int AK47assist = 0 ;
int M4A1Sassist = 0 ;
int M4A4assist = 0 ;
int AUGassist = 0 ;
int SG553assist = 0 ;
//int SG552assist = // 1.6, CSS

//Sniper Assist Integer(s)
int SSG08assist = 0 ;
int AWPassist = 0 ;
int SCAR20assist = 0 ;
int G3SG1assist = 0 ;

//Shotgun Assist Integer(s)
int MAG7assist = 0 ;
int SAWEDOFFassist = 0 ;
int XM1014assist = 0 ;
int NOVAassist = 0 ;
//int BENELLI_M3assist = 0// 1.6, CSS

//LMG Assist Integer(s)
int M249assist = 0 ;
int NEGEVassist = 0 ;

//Other (Weapon) Assist Integer(s)
int GRENADEassist = 0 ; //Expand in the future ie HE, Flash, Decoy, Etc
int KNIFEassist = 0 ;

/////////////////////////////////////////////////////////////////////// Weapon Death definiton(s)

//Pistol Death Variable(s)
#define USPSdeath ad1
#define P2000death ad2
#define GLOCK18death ad3
#define DUEL_BERRETASdeath ad4
  #define DULIESdeath DUEL_BERRETASdeath
#define P250death bd1
//#define p228death // 1.6, CSS
#define CZ75death bd2
#define FIVESEVENdeath cd1
#define TEC9death cd2
#define DESERT_EAGLEdeath dd1
  #define DEAGLE DESERT_EAGLEdeath
#define R8_REVOLVERdeath ad5
  #define REVOLVERdeath R8_REVOLVERdeath
  
//SMG Death Variable(s)
#define MAC10death ad6
#define MP9death ad7
//#define TMPdeath // 1.6, CSS
#define MP7death ad8
//#define MP5death // 1.6, CSS
#define UMP45death bd3
#define P90death cd3
#define PPBIZONdeath ad9
  #define BIZONdeath PPBIZONdeath

//Rifle Death Variable(s)
#define FAMASdeath ad10
#define GALILARdeath ad15
  #define GALILdeath GALILARdeath
#define AK47death bd4
#define M4A1Sdeath bd5
#define M4A4death bd6
#define AUGdeath cd4
#define SG553death cd5
  #define SGdeath SG553death
//#define SG552death // 1.6, CSS

//Sniper Death Variable(s)
#define SSG08death dd2
  #define SCOUTdeath SSG08death
  #define SSGdeath SSG08death
#define AWPdeath dd3
#define SCAR20death cd6
  #define CT-AUTOdeath
#define G3SG1death cd7
  #define T-AUTOdeath G3SG1
  
//Shotgun Death Variable(s)
#define MAG7death ad11
#define SAWEDOFFdeath ad12
#define XM1014death ad13
  #define AUTOSHOTTYdeath XM1014
#define NOVAdeath ad14
//#define BENELLI_M3death // 1.6, CSS

//LMG Death Variable(s)
#define M249death cd8
#define NEGEVdeath cd9

//Other (Weapon) Death Variable(s)
#define GRENADEdeath dd4 //Expand in the future ie HE, Flash, Decoy, Etc
#define KNIFEdeath dd5

/////////////////////////////////////////////////////////////////////// Weapon Death Sums

#define ad ad1+ad2+ad3+ad4+ad5+ad6+ad7+ad8+ad9+ad10+ad11+ad12+ad13+ad14+ad15 //ad 1-15
#define bd bd1+bd2+bd3+bd4+bd5+bd6 //bd 1-6
#define cd cd1+cd2+cd3+cd4+cd5+cd6+cd7+cd8+cd9 //cd 1-9
#define dd dd1+dd2+dd3+dd4+dd5//dd 1-5

#define DTotal ad+bd+cd+dd//Counts Total of Deaths

/////////////////////////////////////////////////////////////////////// Weapon death Integer(s)

//Pistol Death Integer(s)
int USPSdeath = 0 ; 
int P2000death = 0 ; 
int GLOCK18death = 0 ; 
int DUEL_BERRETASdeath = 0 ; 
int P250death = 0 ; 
//int p228death = // 1.6, CSS
int CZ75death = 0 ; 
int FIVESEVENdeath = 0 ; 
int TEC9death = 0 ; 
int DESERT_EAGLEdeath = 0 ; 
int R8_REVOLVERdeath = 0 ; 
  
//SMG Death Integer(s)
int MAC10death = 0 ; 
int MP9death = 0 ; 
//int TMPdeath = // 1.6, CSS
int MP7death = 0 ; 
//int MP5death = // 1.6, CSS
int UMP45death = 0 ; 
int P90death = 0 ; 
int PPBIZONdeath = 0 ; 

//Rifle Death Integer(s)
int FAMASdeath = 0 ; 
int GALILARdeath = 0 ;
int AK47death = 0 ;
int M4A1Sdeath = 0 ;
int M4A4death = 0 ;
int AUGdeath = 0 ;
int SG553death = 0 ;
//int SG552death = // 1.6, CSS

//Sniper Death Integer(s)
int SSG08death = 0 ;
int AWPdeath = 0 ;
int SCAR20death = 0 ;
int G3SG1death = 0 ;

//Shotgun Death Integer(s)
int MAG7death = 0 ;
int SAWEDOFFdeath = 0 ;
int XM1014death = 0 ;
int NOVAdeath = 0 ;
//int BENELLI_M3death = 0// 1.6, CSS

//LMG Death Integer(s)
int M249death = 0 ;
int NEGEVdeath = 0 ;

//Other (Weapon) Death Integer(s)
int GRENADEdeath = 0 ; //Expand in the future ie HE, Flash, Decoy, Etc
int KNIFEdeath = 0 ;

/////////////////////////////////////////////////////////////////////// Variable(s)

//Score Variable(s)
int x = 0 ;//Rounds won
int y = 0 ;//Rounds lost

//Round Impact Variable(s)
int k5 = 0 ;//ACE
int k4 = 0 ;//4k
int ds = 0 ;//suicide
int kf = 0 ;//teamkill

//Kill Variables(s) (for intermediate mode)
int aks = 0 ;//Weapon class A Kill
int bks = 0 ;//Weapon class B Kill
int cks = 0 ;//Weapon class C Kill
int dks = 0 ;//Weapon class D Kill

//Assist Variable(s) (for intermediate mode)
int aas = 0 ;//Weapon class A Assist
int bas = 0 ;//Weapon class B Assist
int cas = 0 ;//Weapon class C Assist
int das = 0 ;//Weapon class D Assist

//Death Variables (for intermediate mode)
int ads = 0 ;//Weapon class A Death
int bds = 0 ;//Weapon class B Death
int cds = 0 ;//Weapon class C Death
int dds = 0 ;//Weapon class D Death

//Headshot Variable(s)
int hk = 0 ;//Headshots

//Other Variable(s)
int KA = 0 ;//Kills without Weapon skill class (for simple mode)
int AA = 0 ;//Assists without Weapon skill class (for simple mode)
int DA = 0 ;//Deaths without Weapon skill class (for simple mode)

/////////////////////////////////////////////////////////////////////// Score definition(s)

#define R 4*(x-y)  //Round Score
#define P k5+((4*k4)/5)-(ds+kf) //Round Impact Score
#define K ak+(1.25*bk)+(.5*ck)+(2*dk) //Kill Score (based on weapon skill)
#define A (aa+(1.25*ba)+(.5*ca)+(2*da))/2 //Assist Score (based on weapon skill)
#define H .2*hk  //Headshot Score
#define D ad+(bd/1.25)+(cd/.5)+(dd/2) //Death Score (based on weapon skill)
#define ELO R+P+(K+A+H)/D //Overall Elo Score

#define KDR KTotal/DTotal //Kill Death Ratio
#define HSR (hk/KTotal)*100 //Headshot Percentage


///////////////////////////////////////////////////////////////////////

// Full Equation (4(x-y)) + (k5+((4*k4)/5)-(ds+kf)) + (((ak+(1.25*bk)+(.5*ck)+(2*dk)) + (.5(aa+(1.25*ba)+(.5*ca)+(2*da))))+(.2*h)/(ad+(bd/1.25)+(cd/.5)+(dd/2)))

/////////////////////////////////////////////////////////////////////// Question Variable(s) [and STOP Variable]

int RoundsWonQuestion = 1;
int RoundsLostQuesiton = 1;
int AceQuestion = 1;
int FourkQuestion = 1;
int SuicideQuestion = 1;
int TeamkillQuestion = 1;
int HeadshotQuestion = 1;

//Pistol killQuestion Integer(s)
int USPSkillQuestion = 1 ; 
int P2000killQuestion = 1 ; 
int GLOCK18killQuestion = 1 ; 
int DUEL_BERRETASkillQuestion = 1 ; 
int P250killQuestion = 1 ; 
//int p228killQuestion = 1// 1.6, CSS
int CZ75killQuestion = 1 ; 
int FIVESEVENkillQuestion = 1 ; 
int TEC9killQuestion = 1 ; 
int DESERT_EAGLEkillQuestion = 1 ; 
int R8_REVOLVERkillQuestion = 1 ; 
  
//SMG killQuestion Integer(s)
int MAC10killQuestion = 1 ; 
int MP9killQuestion = 1 ; 
//int TMPkillQuestion = 1// 1.6, CSS
int MP7killQuestion = 1 ; 
//int MP5killQuestion = 1// 1.6, CSS
int UMP45killQuestion = 1 ; 
int P90killQuestion = 1 ; 
int PPBIZONkillQuestion = 1 ; 

//Rifle killQuestion Integer(s)
int FAMASkillQuestion = 1 ; 
int GALILARkillQuestion = 1 ;
int AK47killQuestion = 1 ;
int M4A1SkillQuestion = 1 ;
int M4A4killQuestion = 1 ;
int AUGkillQuestion = 1 ;
int SG553killQuestion = 1 ;
//int SG552killQuestion = 1// 1.6, CSS

//Sniper killQuestion Integer(s)
int SSG08killQuestion = 1 ;
int AWPkillQuestion = 1 ;
int SCAR20killQuestion = 1 ;
int G3SG1killQuestion = 1 ;

//Shotgun killQuestion Integer(s)
int MAG7killQuestion = 1 ;
int SAWEDOFFkillQuestion = 1 ;
int XM1014killQuestion = 1 ;
int NOVAkillQuestion = 1 ;
//int BENELLI_M3killQuestion = 1// 1.6, CSS

//LMG killQuestion Integer(s)
int M249killQuestion = 1 ;
int NEGEVkillQuestion = 1 ;

//Other (Weapon) killQuestion Integer(s)
int GRENADEkillQuestion = 1 ; //Expand in the future ie HE, Flash, Decoy, Etc
int KNIFEkillQuestion = 1 ;

//Pistol assistQuestion Integer(s)
int USPSassistQuestion = 1 ; 
int P2000assistQuestion = 1 ; 
int GLOCK18assistQuestion = 1 ; 
int DUEL_BERRETASassistQuestion = 1 ; 
int P250assistQuestion = 1 ; 
//int p228assistQuestion = 1// 1.6, CSS
int CZ75assistQuestion = 1 ; 
int FIVESEVENassistQuestion = 1 ; 
int TEC9assistQuestion = 1 ; 
int DESERT_EAGLEassistQuestion = 1 ; 
int R8_REVOLVERassistQuestion = 1 ; 
  
//SMG assistQuestion Integer(s)
int MAC10assistQuestion = 1 ; 
int MP9assistQuestion = 1 ; 
//int TMPassistQuestion = 1// 1.6, CSS
int MP7assistQuestion = 1 ; 
//int MP5assistQuestion = 1// 1.6, CSS
int UMP45assistQuestion = 1 ; 
int P90assistQuestion = 1 ; 
int PPBIZONassistQuestion = 1 ; 

//Rifle assistQuestion Integer(s)
int FAMASassistQuestion = 1 ; 
int GALILARassistQuestion = 1 ;
int AK47assistQuestion = 1 ;
int M4A1SassistQuestion = 1 ;
int M4A4assistQuestion = 1 ;
int AUGassistQuestion = 1 ;
int SG553assistQuestion = 1 ;
//int SG552assistQuestion = 1// 1.6, CSS

//Sniper assistQuestion Integer(s)
int SSG08assistQuestion = 1 ;
int AWPassistQuestion = 1 ;
int SCAR20assistQuestion = 1 ;
int G3SG1assistQuestion = 1 ;

//Shotgun assistQuestion Integer(s)
int MAG7assistQuestion = 1 ;
int SAWEDOFFassistQuestion = 1 ;
int XM1014assistQuestion = 1 ;
int NOVAassistQuestion = 1 ;
//int BENELLI_M3assistQuestion = 1// 1.6, CSS

//LMG assistQuestion Integer(s)
int M249assistQuestion = 1 ;
int NEGEVassistQuestion = 1 ;

//Other (Weapon) assistQuestion Integer(s)
int GRENADEassistQuestion = 1 ; //Expand in the future ie HE, Flash, Decoy, Etc
int KNIFEassistQuestion = 1 ;

//Pistol deathQuestion Integer(s)
int USPSdeathQuestion = 1 ; 
int P2000deathQuestion = 1 ; 
int GLOCK18deathQuestion = 1 ; 
int DUEL_BERRETASdeathQuestion = 1 ; 
int P250deathQuestion = 1 ; 
//int p228deathQuestion = 1// 1.6, CSS
int CZ75deathQuestion = 1 ; 
int FIVESEVENdeathQuestion = 1 ; 
int TEC9deathQuestion = 1 ; 
int DESERT_EAGLEdeathQuestion = 1 ; 
int R8_REVOLVERdeathQuestion = 1 ; 
  
//SMG deathQuestion Integer(s)
int MAC10deathQuestion = 1 ; 
int MP9deathQuestion = 1 ; 
//int TMPdeathQuestion = 1// 1.6, CSS
int MP7deathQuestion = 1 ; 
//int MP5deathQuestion = 1// 1.6, CSS
int UMP45deathQuestion = 1 ; 
int P90deathQuestion = 1 ; 
int PPBIZONdeathQuestion = 1 ; 

//Rifle deathQuestion Integer(s)
int FAMASdeathQuestion = 1 ; 
int GALILARdeathQuestion = 1 ;
int AK47deathQuestion = 1 ;
int M4A1SdeathQuestion = 1 ;
int M4A4deathQuestion = 1 ;
int AUGdeathQuestion = 1 ;
int SG553deathQuestion = 1 ;
//int SG552deathQuestion = 1// 1.6, CSS

//Sniper deathQuestion Integer(s)
int SSG08deathQuestion = 1 ;
int AWPdeathQuestion = 1 ;
int SCAR20deathQuestion = 1 ;
int G3SG1deathQuestion = 1 ;

//Shotgun deathQuestion Integer(s)
int MAG7deathQuestion = 1 ;
int SAWEDOFFdeathQuestion = 1 ;
int XM1014deathQuestion = 1 ;
int NOVAdeathQuestion = 1 ;
//int BENELLI_M3deathQuestion = 1// 1.6, CSS

//LMG deathQuestion Integer(s)
int M249deathQuestion = 1 ;
int NEGEVdeathQuestion = 1 ;

//Other (Weapon) deathQuestion Integer(s)
int GRENADEdeathQuestion = 1 ; //Expand in the future ie HE, Flash, Decoy, Etc
int KNIFEdeathQuestion = 1 ;

//Other Question Integer(s)
int KilltotalQuestion = 1 ;//(for simple mode)
int AssisttotalQuestion = 1 ;//(for simple mode)
int DeathtotalQuestion = 1 ;//(for simple mode)

int Mode = 0;
int STOP = 0;


//////////////////////////////////////////////////////////////////////// Active Code Start

void setup() {
  Serial.begin(9600);
  
//////////////////////////////////////////////////////////////////////// Simple/Advanced Startup Mode

if (Mode == 0) {
    Serial.println ("Simple or Advanced Mode? (1 for Simple, 0 for Advanced)");
    while (!Serial.available()); // Wait for characters
     Mode = Serial.read()-48;
     if (Mode == 1){
         delay (1000);
         Serial.println ("Launching Simple Mode...");
         delay (2000);
     } else {
         delay (1000);
         Serial.println ("Launching Advanced Mode...");
         delay (2000); 
   }
  }
}
//////////////////////////////////////////////////////////////////////// End of Startup

void loop() {
    if (Mode == 1){
        goto Simple;
    }  else  {
        goto Advanced;
    }
//////////////////////////////////////////////////////////////////////// Start of Simple Mode code

 Simple:{
  char buffer[]= {' ',' ',' ',' ',' ',' ',' ',' '};// old (using it as a reminder for later)
  
//////////////////////////////////////////////////////////////////////// Rounds Won

  if (RoundsWonQuestion == 1) {
    Serial.println ("Rounds Won?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     x = atoi(buffer);
     Serial.println (x);
     delay (1000);
     RoundsWonQuestion = 0;
   }
   
//////////////////////////////////////////////////////////////////////// Buffer Reset 1

   if (STOP == 0) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin(9600);
   STOP = 1;
   }
   
//////////////////////////////////////////////////////////////////////// Rounds Lost

   if (RoundsLostQuesiton == 1) {
    Serial.println ("Rounds Lost?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     y = atoi(buffer);
     Serial.println (y);
     delay (1000);
     RoundsLostQuesiton = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 2

   if (STOP == 1) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i )
      buffer = (char)0;
   Serial.begin(9600);
   STOP = 2;
   }
   
//////////////////////////////////////////////////////////////////////// Aces

   if (AceQuestion == 1) {
    Serial.println ("Aces?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     k5 = atoi(buffer);
     Serial.println (k5);
     delay (1000);
     AceQuestion = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 3

   if (STOP == 2) {Serial.end();
   for( int i = 0; i < sizeof(buffer);  ++i )
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 3;
   }
   
//////////////////////////////////////////////////////////////////////// 4ks

   if (FourkQuestion == 1) {
    Serial.println ("4ks?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     k4 = atoi(buffer);
     Serial.println (k4);
     delay (1000);
     FourkQuestion = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 4

   if (STOP == 3) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i )
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 4;
   }

//////////////////////////////////////////////////////////////////////// Suicides

   if (SuicideQuestion  == 1) {
    Serial.println ("Suicides?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     ds = atoi(buffer);
     Serial.println (ds);
     delay (1000);
     SuicideQuestion  = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 5

   if (STOP == 4) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i )
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 5;
   }

//////////////////////////////////////////////////////////////////////// Teamkills

   if (TeamkillQuestion == 1) {
    Serial.println ("Teamkills?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     kf = atoi(buffer);
     Serial.println (kf);
     delay (1000);
     TeamkillQuestion = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 6
   
   if (STOP == 5) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 6;
   }

//////////////////////////////////////////////////////////////////////// Kills

   if (KilltotalQuestion  == 1) {
    Serial.println ("Kills?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     KA = atoi(buffer);
     Serial.println (KA);
     delay (1000);
     KilltotalQuestion  = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 7
  
   if (STOP == 6) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 7;
   }

//////////////////////////////////////////////////////////////////////// Assists

   if (AssisttotalQuestion == 1) {
    Serial.println ("Assists?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     AA = atoi(buffer);
     Serial.println (AA);
     delay (1000);
     TeamkillQuestion = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 8
  
   if (STOP == 7) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 8;
   }

//////////////////////////////////////////////////////////////////////// Deaths

   if (DeathtotalQuestion == 1) {
    Serial.println ("Deaths?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     DA = atoi(buffer);
     Serial.println (DA);
     delay (1000);
     TeamkillQuestion = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 9
  
   if (STOP == 8) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 9;
   }
//////////////////////////////////////////////////////////////////////// Headshots

   if (HeadshotQuestion == 1) {
    Serial.println ("Headshots?");
    while (!Serial.available()); // Wait for characters
     Serial.readBytesUntil('?', buffer, 3);
     hk = atoi(buffer);
     Serial.println (hk);
     delay (1000);
     HeadshotQuestion = 0;
   }
//////////////////////////////////////////////////////////////////////// Buffer Reset 10
  
   if (STOP == 9) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin (9600);
   STOP = 10;
   }
 Serial.println ();
 Serial.println ();
 Serial.println ();
 Serial.println ();
 Serial.println ();
//////////////////////////////////////////////////////////////////////// Game Statistics Text Output (Simple Mode)

int KDRS = (KA/DA); //Kill Death Ratio Calculation (simple)
int HSRS = (hk/KA)*100; //Headshot Percentage Calculation (simple)

  if (STOP == 10) {
    Serial.print ("Score: ");
    Serial.print (x);
    Serial.print (" - ");
    Serial.println (y);
    
    if (x > y) {
      Serial.println ("Victory!");
    }  else if (x < y)  {
      Serial.println ("Defeat!");
    }  else  {
      Serial.println ("Draw.");
    }
    
    Serial.print ("KDR: ");
    Serial.println (KDRS);
    
    Serial.print ("Headshot Percentage: ");
    Serial.print (HSRS);
    Serial.println ("%");
    Serial.println ( );
    
    Serial.print ("Total Kills: ");
    Serial.println (KA);
    delay (500);
    Serial.print ("Total Assists: ");
    Serial.println (AA);
    delay (500);
    Serial.print ("Total Deaths: ");
    Serial.println (DA);
    Serial.println ( );
    delay (500);
    
    Serial.print ("Kills Score: ");
    Serial.println ("Advanced Only");
    delay (500);
    Serial.print ("Assists Score: ");
    Serial.println ("Advanced Only");
    delay (500);
    Serial.print ("Deaths Score: ");
    Serial.println ("Advanced Only");
    Serial.println ( );
    delay (500);
    
    Serial.println (ELO);
    delay (500);
   
  
  STOP = 11;
  }
  }////// The Brackets for the end of "Simple Mode"
  
 //////////////////////////////////////////////////////////////////////// Start of Advanced Mode Code
 
  Advanced:{
  if (STOP == 0) {
  Serial.print ("WIP");
  STOP = 1;
  }
 }////// The Brackets for the end of "Advanced Mode" 
}////// End of Void loop
    

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to comment
https://linustechtips.com/topic/724416-calculations-not-printing/
Share on other sites

Link to post
Share on other sites

3 hours ago, Yacovrex said:

I am a new coder... i have done a substantial amount of research and cant seem to find an answer.

in the code below, when i have the head-shot percentage print. it is ALWAYS 0% and I cant seem to find out why. Any suggestions?

Please put your code in code tags and also only post the code that interacts with the parts having a problem. Also, what language?

ENCRYPTION IS NOT A CRIME

Link to post
Share on other sites

Image result for mother of god meme

Setting aside the "elephant in the room", I think it's because you're using integer division and not floating point division.

Change

int HSRS = (hk/KA)*100; //Headshot Percentage Calculation (simple)

To something like

int HSRS = ((float)hk/(float)KA)*100; //Headshot Percentage Calculation (simple)

 

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

41 minutes ago, Nineshadow said:

Setting aside the "elephant in the room"

That's certainly a very large elephant... O.o

The single biggest problem in communication is the illusion that it has taken place.

Link to post
Share on other sites

19 hours ago, Nineshadow said:

 


int HSRS = ((float)hk/(float)KA)*100; //Headshot Percentage Calculation (simple)

 

I will try this fix and reply back.

It is  a very large.... an inefficient code.... but I'm still new and will make it more efficient as I go.

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

OMG NINESHADOW YOU ARE THE F***** BEST I LOVE YOU!!

it worked... you are awesome...

is there a way to make the

int KDRS = ((float)KA/(float)DA); //Kill Death Ratio Calculation (simple)

a decimal?

as in if you get 32 kills (KA=32) and 16 deaths (DA=16) instead of being  a flat 2 (or rounding up/down) it gives a decimal with 3 significant figures?

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

15 minutes ago, Yacovrex said:

it is  a very large.... an inefficient code.... but I'm still new and will make it more efficient as I go.

You won't make it more efficient like that.

First burn it with fire.

Then start making it more efficient.

 

Yes, I'm joking, but I think you get the point. Start learning new stuff and keep on using your new knowledge until you develop your skills.

 

 

 

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

9 minutes ago, Nineshadow said:

You won't make it more efficient like that.

First burn it with fire.

Then start making it more efficient.

 

Yes, I'm joking, but I think you get the point. Start learning new stuff and keep on using your new knowledge until you develop your skills.

 

 

 

Thanks so much i will most definitely keep improving the code as i learn more stuff.

 

For the decimal question above,

Do you think changing the "#define" to "float" would do it? Because if yes.. I have a LOT of things to change

 

From:

#define KDR KTotal/DTotal //Kill Death Ratio
#define HSR (hk/KTotal)*100 //Headshot Percentage

 

To:

float KDR = KTotal/DTotal ; //Kill Death Ratio
float HSR = (hk/KTotal)*100 ; //Headshot Percentage

 

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

Also, why are these series of commands adding SO MUCH to the SRAM total

 

  if (ELO > 1, ELO <= 2) Serial.println ("Unranked");
  if (ELO > 2, ELO <= 3) Serial.println ("Silver 1");
  if (ELO > 3, ELO <= 4) Serial.println ("Silver 2");
  if (ELO > 4, ELO <= 5) Serial.println ("Silver 3");
  if (ELO > 5, ELO <= 6) Serial.println ("Silver 4");
  if (ELO > 6, ELO <= 7) Serial.println ("Silver Elite");
  if (ELO > 7, ELO <= 8) Serial.println ("Silver Elite Master");
  if (ELO > 8, ELO <= 9) Serial.println ("Gold Nova 1");
  if (ELO > 9, ELO <= 10) Serial.println ("Gold Nova 2");
  if (ELO > 10, ELO <= 11) Serial.println ("Gold Nova 3");
  if (ELO > 11, ELO <= 12) Serial.println ("Gold Nova Master");
  if (ELO > 12, ELO <= 13) Serial.println ("Master Guardian 1");
  if (ELO > 13, ELO <= 14) Serial.println ("Master Guardian 2");
  if (ELO > 14, ELO <= 15) Serial.println ("Master Guardian Elite");
  if (ELO > 15, ELO <= 16) Serial.println ("Distinguished Master Guardian");
  if (ELO > 16, ELO <= 17) Serial.println ("Legendary Eagle");
  if (ELO > 17, ELO <= 18) Serial.println ("Legendary Eagle Master");
  if (ELO > 18, ELO <= 19) Serial.println ("Supreme Master First Class");
  if (ELO > 19, ELO <= 20) Serial.println ("Global Elite");

 

This brings the total from 32% to 198 O-O

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

5 minutes ago, Yacovrex said:

Also, why are these series of commands adding SO MUCH to the SRAM total

 

  if (ELO > 1, ELO <= 2) Serial.println ("Unranked");
  if (ELO > 2, ELO <= 3) Serial.println ("Silver 1");
  if (ELO > 3, ELO <= 4) Serial.println ("Silver 2");
  if (ELO > 4, ELO <= 5) Serial.println ("Silver 3");
  if (ELO > 5, ELO <= 6) Serial.println ("Silver 4");
  if (ELO > 6, ELO <= 7) Serial.println ("Silver Elite");
  if (ELO > 7, ELO <= 8) Serial.println ("Silver Elite Master");
  if (ELO > 8, ELO <= 9) Serial.println ("Gold Nova 1");
  if (ELO > 9, ELO <= 10) Serial.println ("Gold Nova 2");
  if (ELO > 10, ELO <= 11) Serial.println ("Gold Nova 3");
  if (ELO > 11, ELO <= 12) Serial.println ("Gold Nova Master");
  if (ELO > 12, ELO <= 13) Serial.println ("Master Guardian 1");
  if (ELO > 13, ELO <= 14) Serial.println ("Master Guardian 2");
  if (ELO > 14, ELO <= 15) Serial.println ("Master Guardian Elite");
  if (ELO > 15, ELO <= 16) Serial.println ("Distinguished Master Guardian");
  if (ELO > 16, ELO <= 17) Serial.println ("Legendary Eagle");
  if (ELO > 17, ELO <= 18) Serial.println ("Legendary Eagle Master");
  if (ELO > 18, ELO <= 19) Serial.println ("Supreme Master First Class");
  if (ELO > 19, ELO <= 20) Serial.println ("Global Elite");

 

This brings the total from 32% to 198% O-O

fixed. made them else if statements.

 

New question, why do if statements take up SO much storage?

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

18 minutes ago, Yacovrex said:

Also, why are these series of commands adding SO MUCH to the SRAM total

 

  if (ELO > 1, ELO <= 2) Serial.println ("Unranked");
  if (ELO > 2, ELO <= 3) Serial.println ("Silver 1");
  if (ELO > 3, ELO <= 4) Serial.println ("Silver 2");
  if (ELO > 4, ELO <= 5) Serial.println ("Silver 3");
  if (ELO > 5, ELO <= 6) Serial.println ("Silver 4");
  if (ELO > 6, ELO <= 7) Serial.println ("Silver Elite");
  if (ELO > 7, ELO <= 8) Serial.println ("Silver Elite Master");
  if (ELO > 8, ELO <= 9) Serial.println ("Gold Nova 1");
  if (ELO > 9, ELO <= 10) Serial.println ("Gold Nova 2");
  if (ELO > 10, ELO <= 11) Serial.println ("Gold Nova 3");
  if (ELO > 11, ELO <= 12) Serial.println ("Gold Nova Master");
  if (ELO > 12, ELO <= 13) Serial.println ("Master Guardian 1");
  if (ELO > 13, ELO <= 14) Serial.println ("Master Guardian 2");
  if (ELO > 14, ELO <= 15) Serial.println ("Master Guardian Elite");
  if (ELO > 15, ELO <= 16) Serial.println ("Distinguished Master Guardian");
  if (ELO > 16, ELO <= 17) Serial.println ("Legendary Eagle");
  if (ELO > 17, ELO <= 18) Serial.println ("Legendary Eagle Master");
  if (ELO > 18, ELO <= 19) Serial.println ("Supreme Master First Class");
  if (ELO > 19, ELO <= 20) Serial.println ("Global Elite");

 

This brings the total from 32% to 198 O-O

What I don't understand is why is it being tested that way. if (ELO > 1, ELO <= 2) basically means if (ELO == 2)

 

I mean, it's probably not going to solve why RAM is being consumed, but that's the first thing I'm seeing that's a problem.

 

And if you can't do ELO == 2, then what kind of programming system is this!?

Link to post
Share on other sites

39 minutes ago, M.Yurizaki said:

What I don't understand is why is it being tested that way. if (ELO > 1, ELO <= 2) basically means if (ELO == 2)

 

I mean, it's probably not going to solve why RAM is being consumed, but that's the first thing I'm seeing that's a problem.

 

And if you can't do ELO == 2, then what kind of programming system is this!?

If it's a floating point number then it makes sense.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

I certainly hope this isn't the source code of CSGO.

CPU: Intel Core i5-6600k 4.4GHz | Motherboard: Asus ROG STRIX Z270F Gaming | Cooler: Cryorig H7 | RAM: GSkill Ripjaws V 8GB 2x4 3200 MHz | GPU: MSI GTX 1070 Gaming X | PSU: Seasonic G-550w 80+ Gold Certified, Semi Modular | Storage: 250GB Samsung 850 EVO, 1TB Western Digital Caviar Blue | Case: NZXT S340 Elite (Black/Red) | Monitor: BenQ XL2411 144hz | Keyboard: Corsair STRAFE RGB Cherry MX Silent | Mouse: Corsair M65 Pro RGB

 

I'd like to make a Chemistry joke, but all the good ones ARGON. *nudgenudge *winkwink

Link to post
Share on other sites

First of all, sorry it took me so long to respond. I had midterms and i was busy studying for a long, long time.

Second, the (ELO > 1, ELO <= 2)  is just a place holder. the 1s, 2s, 3s etc are going to be replaced with different values once i calculate appropriate numbers for each rank.

Third, If this was CSGO's source code all of our ranks a screwed. LOL

Fourth, making most of the "if" statements "else if"s fixed the problem. Just wondering why just having "if" statements would cause so much memory usage.

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

If anyone is interested in assisting me with this project tell me.

I can use all the help I can get.....

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

Lastly (I hope),

Is there a better way of clearing:

 

  char buffer[]= {' ',' ',' ',' ',' ',' ',' ',' '};

 

 

Other than:

 

   if (STOP == 0) {Serial.end();
      for( int i = 0; i < sizeof(buffer);  ++i ) // clears buffer
      buffer = (char)0;
   Serial.begin(9600);
   STOP = 1;
   }

 

(my int for "STOP" is earlier in the code)

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

I don't think there is a faster way to do this, but since it's a O(n) "algorithm" it's not bad at all. But you have an error in here, you are doing buffer = (char)0; but it should be buffer = (char)0; otherwise the loop around it is pretty useless.

EDIT: The forums software removes [ i ] because it's interpreted as a BB-code. That's why you should use the code-Tag my friend :P

 

If you don't know what O(n) means, have a look at here: https://en.wikipedia.org/wiki/Big_O_notation

 

Basically O(n) means, that the time your algorithm takes is scaling with n (the amount of data you put into it, in this case its sizeof(buffer) ). O(n²) means, that it's scaling quadratically (I don't know the correct english word for it, sorry) and so on.

 

You could change it to this:

int size = sizeof(buffer);
for( int i = 0; i < size;  ++i ) // clears buffer
      buffer[i] = (char)0;

This way sizeof(buffer) will not be called every time, but I don't exactly know if this is the case in C/C++ at all or if the compiler detects this and fixes it for you. But I think you get what I'm trying to tell you :)

Link to post
Share on other sites

  • 2 weeks later...
On 2/1/2017 at 3:48 AM, Organized said:

you are doing buffer = (char)0; but it should be buffer = (char)0;

First, what is the difference here? It looks the same but I am, at the moment, virtually brain dead as i just had 3 tests in a row.

Second, I am a coding pleb and when I read the "Big_O_Notation" My brain exploded.

Third, I will try it and see if it works. Do I have to put it after each question code (like I had it before) or just after the char buffer / before the first question code?

 

Thanks

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

3 hours ago, Yacovrex said:

First, what is the difference here? It looks the same but I am, at the moment, virtually brain dead as i just had 3 tests in a row.

I don't think there is a difference and unless your programming language has strict typing. You don't need to type cast a number as long as it's within the range of that variable's data type.

Quote

Second, I am a coding pleb and when I read the "Big_O_Notation" My brain exploded.

The Big-O notation describes the complexity of an algorithm, given the worst case scenario (which you always expect) and n items. Or "How long does this algorithm take for n items?" For example, the bubble sort algorithm has a complexity of O(n^2). This means for every item you add to a list you're sorting using bubble sort, the length of time to execute grows exponentially. So let's say it takes 1ms to sort 1 item, it will take 4ms to sort 2 items, 9ms to sort 3 items, etc. O(n) means it grows linearly.

Link to post
Share on other sites

3 hours ago, Yacovrex said:

First, what is the difference here? It looks the same but I am, at the moment, virtually brain dead as i just had 3 tests in a row.

Look at my edit. The forum software removed essential parts. I think you can just ignore it, because in your actual code you got it right.

 

3 hours ago, Yacovrex said:

Third, I will try it and see if it works. Do I have to put it after each question code (like I had it before) or just after the char buffer / before the first question code?

I don't really know what you mean. Just try it out and tell us if it doesn't work. But then, a little bit more precise and with code snippets (use the code-Tags, the "<>" icon in the reply box). :)

 

Thanks @M.Yurizaki for explaining it as a native speaker, it's pretty difficult for me to frame things like this.

Link to post
Share on other sites

OK, thank you all for helping me I am going to try it out and reply back in the near future (I have wrestling nationals this week).

 

Thanks so much again!

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×