ELO.f 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. c DISCUSSION :
  2. c Driver for ELO function
  3. c
  4. c Copyright 2004 Jeff Cliff
  5. c
  6. c This program is free software: you can redistribute it and/or modify
  7. c it under the terms of the GNU General Public License as published by
  8. c the Free Software Foundation, either version 3 of the License, or (at
  9. c your option) any later version.
  10. c
  11. c This program is distributed in the hope that it will be useful, but
  12. c WITHOUT ANY WARRANTY; without even the implied warranty of
  13. c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. c General Public License for more details.
  15. c
  16. c You should have received a copy of the GNU General Public License
  17. c along with this program. If not, see https://www.gnu.org/licenses/
  18. c
  19. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  20. program main
  21. REAL player1rating
  22. REAL player2rating
  23. REAL x
  24. write (*,*) 'input the first player''s rating'
  25. read (*,*) player1rating
  26. write (*,*) 'input the second player''s rating'
  27. read (*,*) player2rating
  28. x = elo(player1rating,player2rating)
  29. write (*,*) 'player1''s odds of winning is ', x, '%'
  30. x = elo(player2rating,player1rating)
  31. write (*,*) 'player2''s odds of winning is ', x, '%'
  32. end
  33. c ccccccccccccccccccccccccccccccccccccccccccccccccc
  34. c ccccccccccccccccccccccccccccccccccccccccccccccccc
  35. c ELO program
  36. c Given two ELO ratings (usually somewhere around 1400)
  37. c the chance of winning for the player with rating r
  38. c is calculated
  39. c
  40. c ccccccccccccccccccccccccccccccccccccccccccccccccc
  41. c ccccccccccccccccccccccccccccccccccccccccccccccccc
  42. REAL function elo(r,s)
  43. REAL r,s,t,u,v
  44. elo = s - r
  45. elo = elo / 400.0D0
  46. t = 100.0D0
  47. u = 1.0D0
  48. v = 10.0D0
  49. elo = t * ( u / ( u + v ** elo ) )
  50. return
  51. end
  52. c ccccccccccccccccccccccccccccccccccccccccccccccccc
  53. c ccccccccccccccccccccccccccccccccccccccccccccccccc