Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:57:08+00:00 2026-06-12T10:57:08+00:00

Edit: Problem solved I’m trying to port over a popular rating algorithm which analyses

  • 0

Edit: Problem solved

I’m trying to port over a popular rating algorithm which analyses some statistics from Counter-Strike matches into a PHP script. The outline of the system can be found in the link below (the bottom part of the news post):
http://www.hltv.org/?pageid=242&eventid=0

Anyway, so I’ve get everything set up in PHP, and I’m reasonably sure that everything is correct. For the purposes of calcuation, assume that:

$rating1K = 5;
$rating2K = 8;
$rating3K = 3;
$rating4K = 0;
$rating5K = 0;
$kills = 30
$deaths = 19
$round = 30

This is my code:

$kpr = $kills / $round; // kills per round
$killRating = ($kills / $round / $kpr); 

$spr = ($round - $deaths) / $round; // survivals per round
$survivalRating = ($round - $deaths) / $round / $spr;    

$averageRMK = ((1*$rating1K + 4*$rating2K + 9*$rating3K + 16*$rating4K + 25*$rating5K)/$round);
$roundsWithMultipleKillsRating = ((1*$rating1K + 4*$rating2K + 9*$rating3K + 16*$rating4K + 25*$rating5K)/$round/$averageRMK);

$rating = ($killRating + 0.7 * $survivalRating + $roundsWithMultipleKillsRating) / 2.7;
echo $rating; 

The problem is that $killRating, $survivalRating and $roundsWithMultipleKillsRating always seem to return 1 in the PHP script, whereas if I calculate them manually myself they are different. For example, if I calculate $killRating myself, I get 1.5789-etc, but PHP returns “1”.

What can I do this fix this problem?

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:57:09+00:00Added an answer on June 12, 2026 at 10:57 am

    You are calculating wrong…

    $kpr = $kills / $round; // kills per round
    $killRating = ($kills / $round / $kpr); 
    

    equals

    $kpr = 30 / 30; // 1
    $killRating = (30 / 30 / 1); //1
    

    And

    $spr = ($round - $deaths) / $round; // survivals per round
    $survivalRating = ($round - $deaths) / $round / $spr;
    

    equals

    $spr = (30 - 19) / 30; // 0.36666
    $survivalRating = (30 - 19) / 30 / 0.3666; // 1
    

    Your own calculation is wrong. PHP does everything fine here.

    Please note that kpr being $kill/$round, when you devide $kill/$round/$kpr it will always be 1. Any number divided by itself equals 1. I can’t beleive everyone is talking about floats and integers without even understanding mathematics…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[EDIT: Problem solved. Please see my answer below.] In my app I call the
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
edit: Solved - mod_rewrite was the problem I can't get CI to work as
edit: I was trying to solve a spoj problem. Here is the link to
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
Problem 1 I'm trying to use an Onclick event from a search button, that
EDIT: Problem solved... and unrelated to the phrasing of the question... sorry for the
EDIT: Problem solved. This was (yet another) situation where the problem wasn't really where
[EDIT]Problem solved, I found the leak. Thank you very much. I'm running a scheduling
EDIT: Problem solved by using $i+1 in function call. I have trouble using variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.