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

  • Home
  • SEARCH
  • 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 6212117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:27:27+00:00 2026-05-24T06:27:27+00:00

Player.prototype.d2 = function(ratingList, rdList) { var tempSum = 0; for (var i = 0;

  • 0
Player.prototype.d2 = function(ratingList, rdList) {
    var tempSum = 0;
    for (var i = 0; i < ratingList.length; i++) {
        var tempE = this.e(ratingList[i], rdList[i]);
        tempSum += Math.pow(this.g(rdList[1]), 2) * tempE * (1 - tempE);
    }
    return 1 / Math.pow(q, 2) * tempSum;
};

This seems to be the bit in question.

Everything seems fine unless ratingList, rdList and outcomeList only contain one value. Then stuff gets set to NaN instead. I’ve tried changing the index to -1, changing the comparison to ratingList.length - 1, even tried it with a decrementing for loop, but it always seems to return NaN if the arrays contain only one value.

Is there any way (I’m sure there is — I guess the question is how) to do away with the for loop and replace it with Array.map() or zip or any composition of those kinds of functions?

You can see ALL of the code here — it’s about 60 LOC

  • 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-05-24T06:27:29+00:00Added an answer on May 24, 2026 at 6:27 am

    In d2 function you have this line in for loop:

    tempSum += Math.pow(this.g(rdList[1]), 2) * tempE * (1 - tempE);
    

    So it is assumed that rdList is 2 elements at least, but you have only one for bob.

    Maybe it have to be rdList[i]?

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

Sidebar

Related Questions

function Player() { var score; this.getScore = function() { return score; } this.setScore =
when i initialize the player like this: $(#jquery_jplayer).jPlayer({ ready: function () { this.element.jPlayer(setFile, /previews/cancion.mp3,
When I run player.php it's giving this error: Warning: Cannot modify header information -
So, i'm attempting simple card game. I have player class with draw function, and
public Player(string name, List<Card> cards) { this.name = name; try { this.stack.insertCards(cards);//Here is the
I am using JW Player in my application. I want to know which function
Just a curiosity, I have played around with prototyping a bit, but it seems
I have this Object Literal: var RPSPlayer = {....} and I want to make
I'm currently making a prototype game where the player walks along the isosurface of
Which Audio Player is this?? I want to add the Above player in my

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.