vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Need an algeorhythm (https://vborg.vbsupport.ru/showthread.php?t=53922)

Dean C 06-06-2003 10:56 AM

Need an algeorhythm
 
.....Or however you spell it... :p

Imagine you have a wins and losses field in the user column. Now instead of adding a rating field and say adding 10 to the rating field for a win and minusing 5 for a loss i thought i'd make myself a little system to work it out.

Basically i don't want people to have a minus rating but remember people who have a loss have participated in some kind of battle so they must have some kind of rating. Basically i need a cool system that will keep my uses happy...

Any ideas?

- miSt

Xenon 06-06-2003 11:16 AM

hmm if you don't want an negativ rating, you can for example use an exponential rating.
so whenever the losses are higher than the wins, the rating will go towards 0, but never be negativ :)

Dean C 06-06-2003 11:31 AM

What i mean was can i have some sample code? :p

Dean C 06-06-2003 11:54 AM

How do this look:

PHP Code:

                  if($post['wins']>$post['losses'])
                  {
                    
$rating $post['wins']*100;
                  } else if(
$post['losses']>$post['wins']) {
                    
$rating = ($post['wins']*100)-($post['losses']*10);
                  } else if(
$post['losses']==$post['wins']) {
                    
$rating = ($post['wins']*100)-($post['losses']*10);
                  } 


Xenon 06-06-2003 12:02 PM

it will give you negative ratings if someone has x losses and 0 wins...

use this:
PHP Code:

$rating exp($post['wins'] - $post['losses']); 

rating range then would be from 0 up to infinity, but never negative :)

Dean C 06-06-2003 03:46 PM

So i'd use this:

PHP Code:

$rating exp(($post['wins']*100)-($post['losses']*10)); 

Instead of this:

PHP Code:

$rating = ($post['wins']*100)-($post['losses']*10); 

:)?

- miSt

Xenon 06-06-2003 04:48 PM

no, use exactly the code i posted :)

the more wins someone has the greater the value will be, there is no need to do the *100

Dean C 06-06-2003 05:31 PM

Ahhh works pretty cool but can you explain to me how it works as the description on php.net was a bit confusing to me. Its basically so i can tell the users how we work out their rating :)?

Thanks

- miSt

Xenon 06-06-2003 09:44 PM

exp(x) is the normal exponentialfunction you should have learned in maths:
e^x

maybe you have toad a faktor smaller than 1 before, if you are awaiting high ammounts of wins ;)
exp(100) would be more than 10^43 :)


All times are GMT. The time now is 06:24 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01067 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete