Answers.Body: <p>You'd have to find a list of players Morphy has played. Then, you'd research as many players who played each of those players. This can all be done by searching by player in a large database. Eventually you'd have a large tree, and the problem comes down to an optimal search algorithm.</p>
  
  <p>You'd search "branches" with a more likely chance of giving you a small Morphy number. This means looking at players who have played more games over their career. For example, if some player A was one of Morphy's opponents who played the most games, you'd look at him first. Then, find one of Player A's opponents (call him B) who played the most games in his lifetime, and look at him first. If doing this recursively with B never leads to you (or gives a poor Morphy number), go on to C: the opponent of player A who played the second most games. If eventually you find all of Player A's opponents don't lead to you, meaning Player A isn't connected to you, go on to the opponent of Morphy who had the second most games.</p>
  
  <p>But it's still a massive job to search. Even if you find a link to yourself, you need to prove/justify that it's the smallest link. Perhaps you could organize all these players into a tree and write a program to efficiently search it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-31T02:40:34.527Z
Answers.LastActivityDate: 2019-12-31T02:46:59.443Z
Answers.LastEditDate: 2019-12-31T02:46:59.443Z
Answers.UserDisplayName: Inertial Ignorance
Answers.Body: <p>I never heard of the 'Morphy number' until I read your post.  I found that my Morphy number is 5.  Here is how I did it.</p>
  
  <p>I started with <a href="https://en.wikipedia.org/wiki/Morphy_number" rel="nofollow noreferrer">Wikipedia</a>  </p>
  
  <p>After looking at the list I realized that my best bet was the simul where I played John Donaldson.  I still regret not pushing the pawn after preparing it so well...</p>
  
  <p>I looked at other American players John would have played and found that he played Reshevsky at <a href="https://www.365chess.com/players/John_W_Donaldson/?p=1&amp;start=600" rel="nofollow noreferrer">Lone Pine 1981</a>. </p>
  
  <p>Per Wikipedia Reshevksy's number is 3.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-31T19:48:45.400Z
Answers.LastActivityDate: 2020-01-02T09:55:22.767Z
Answers.LastEditDate: 2020-01-02T09:55:22.767Z
Answers.UserDisplayName: Michael West
Answers.Body: <p>I had a similar problem not long ago, though not chess related. If I were to pattern this solution off of that one, I would consider storing Morphy in an SQL table along with all of his opponents, along with all of their opponents, and so on, in a parent/child relationship. So you would have one table with two columns (id and parent_id). id would be the child of parent_id and any id could be a parent_id, child id or both. So if Morphy is <code>parent_id=1</code> and he played ids 2-10, you might have</p>
  
  <pre><code>parent_id  |  id
  1          |  2
  1          |  3
  1          |  4
  
  etc.
  
  2          |  25
  2          |  28
  
  etc.
  </code></pre>
  
  <p>The last row would be you. Perhaps you are <code>id=1,100,000</code></p>
  
  <pre><code>1,000,000  |  1,100,000
  </code></pre>
  
  <p>Say this table is call chess_players, you could then recursively query this table to get your id and all of your ancestor parent_ids. Something like this</p>
  
  <pre><code>with recursive cte (id, name, parent_id) as
  (
   select     id,
              parent_id
   from       chess_players
   where      parent_id = 1 and id=1100000 -- Morphy is the parent and you are the child
   union all
   select     p.id,
              p.parent_id
   from       chess_players p
   inner join cte
           on p.parent_id = cte.id
  )
  select * from cte;
  </code></pre>
  
  <p>You will then see all of the parent_ids of your id number all the way up to Morphy's parent_id of 1. I suppose this is your Morphy count and you could use this technique for anyone in your chess_players table.</p>
  
  <p>I'm thinking you could probably scrape a database like <a href="https://chessgames.com" rel="nofollow noreferrer">chessgames.com</a> to populate your table.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-31T20:48:42.057Z
Answers.LastActivityDate: 2019-12-31T21:30:08.390Z
Answers.LastEditDate: 2019-12-31T21:30:08.390Z
Answers.UserDisplayName: Matt Cremeens
Answers.Body: <p>As far as an algorithmic answer goes, if you can get a set of games into a pandas dataframe (Python), the following code should get you the Morphy numbers, unless I've messed up somewhere:</p>
  
  <pre><code>def get_distances(games, 
                    starting_player = 'James Morphy', 
                    max_depth = 100,
                    white_col_name = 'white'
                    black_col_name = 'black')
      player_nums = {starting_player:0}   
      games_left = pd.DataFrame(index = games.index)
      games_left[['white','black']] = games[[white_col_name, black_col_name]]
      for current_depth in range(max_depth):
          known_players = set(player_nums.keys())
          numbered_white = games_left.white.isin(known_players)
          numbered_black = games_left.black.isin(known_players)
          new_white = games_left.loc[numbered_black &amp; (~numbered_white)]            
          new_black = games_left.loc[numbered_white &amp; (~numbered_black)]
          new_players = set(new_white.white).union(set(new_black.black))
          if not new_players:
              return {'player_nums': player_nums, 
                      'result': 'Ran out of connections'}
          for player in new_players:
              player_nums[player] = current_depth+1
          games_left = games_left.loc[~(numbered_white | numbered_black)]
          if games_left.shape[0] == 0:
              return {'player_nums': player_nums, 
                      'result': 'Analyzed all games'}
      return {'player_nums': player_nums,  
              'result':  'Reached maximum depth'}
  </code></pre>
  
  <p>This gets the Morphy number for everyone. Getting just yours is "almost as hard" (for some definition of "almost as hard") as getting all the Morphy numbers. This gets the numbers for a fixed data set. If you want to update the numbers as more games are played, you can just keep rerunning the program, but there's probably some tweaks you can make to make updating more efficient. Also, there have been comments suggesting people think that calculating the Morphy number would have an exponential complexity with respect to the depth number, but as long as the number of games is fixed, this algorithm has polynomial complexity with respect to the number of games.</p>
  
  <p>More information here: <a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-01T18:07:06.077Z
Answers.LastActivityDate: 2020-01-01T18:07:06.077Z
Answers.UserDisplayName: Acccumulation
Answers.Body: <p>This may not help if you do not have games in the ChessBase database (or even enough games), but ChessBase recently released a feature called "WinChain", which TRIES to find your "number" to any player, including Morphy. Nevertheless, I found that it still does not work particularly well for going back that far, but you still might be interested.</p>
  
  <p>Here is an article called "<a href="https://en.chessbase.com/post/three-steps-to-morphy" rel="nofollow noreferrer">Three Steps to Morphy</a>" discussing the feature.</p>
  
  <p>And here is a <a href="https://players.chessbase.com/en/winchain?SrcFirst=&amp;SrcLast=&amp;DestFirst=paul&amp;DestLast=morphy" rel="nofollow noreferrer">link</a> to the page specifically for the Morphy number.</p>
  
  <p>I could not get my Morphy number since my chain was still too long, but I was only four steps from Kasparov, Karpov and Carlsen, and 5 from Fischer.</p>
  
  <p><a href="https://i.sstatic.net/XZsOt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XZsOt.png" alt="enter image description here"></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T10:25:41.613Z
Answers.LastActivityDate: 2020-03-28T10:25:41.613Z
Answers.UserDisplayName: PhishMaster
Answers.Body: <p>Pseudocode to iteratively compute morphy number.</p>
  
  <p>assume you have a database with a table plays of two columns x and y where a row indicates two indeviduals who have played one another.</p>
  
  <pre><code>_morphy = {}
  def Morphy(name):
  
     if name == 'Morphy':
        return 0
  
     if name in _morphy:
        return _morphy[name]
  
     _morphy[name] = math.inf
     score = math.inf
     results = execute(select x, y from plays where x=name or y=name)
     for x, y in results:
        if x == name:
           score = min(score, Morphy(y) + 1)
        elif y == name:
           score = min(score, Morphy(x) + 1)
  
     _morphy[name] = score
     return score
  
  print(Morphy('Jar Jar Binks'))
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-02T15:05:58.167Z
Answers.LastActivityDate: 2020-01-02T15:20:08.490Z
Answers.LastEditDate: 2020-01-02T15:20:08.490Z
Answers.UserDisplayName: Maximilian Schneider
Answers.Body: <p>For me, it was a combination of Wikipedia, WinChain, USCF, and my own knowledge. I worked from both ends. </p>
  
  <p>I started by assuming that getting a link to high-rated players was probably the way to go - if you follow the chain up, eventually you get to famous players with known Morphy numbers, or at least players who have many games in large databases. To that end, I used the USCF website to find my top opponents (using the "Show Game Statistics" link on the Member Detail page, which organizes opponents by rating.) The choice seemed easy: I've only played one IM in my life. I then looked at his top opponents, followed by <em>their</em> top opponents. At that point I lucked out and found a name from the Wikipedia page - Borislav Ivkov, listed as having a rather low Morphy number of 3. So that gave me a Morphy number of 6. I double-checked some other paths, but nothing beat that link.</p>
  
  <p>Of course, I wasn't satisfied with just playing Morphy. I had to beat him. So, I used the USCF website to find the top players I'd beaten, and the top players they beat. This time I used a shortcut: I knew that a particular player that I had once beaten had scored a win against that IM I played. When I checked the Game Statistics, I found that she had also beaten a second IM. I then used the <a href="https://players.chessbase.com/en/winchain" rel="nofollow noreferrer">WinChain</a> tool mentioned in another answer to try to link those two IMs to some players with low Morphy numbers (there were too many false positives if I tried to chain them directly to Morphy.) I also found a somewhat recent game using the USCF Game Statistics pages that wasn't in the database that WinChain uses, which shortened the path by one. Surprisingly, the win path ended up with <em>no</em> names in common with the ones that formed my original Morphy number path. I ended up beating Morphy in 7 steps by going through Arnold Denker.</p>
  
  <p>Based on this experience, my tips are:</p>
  
  <ul>
  <li><p>First, try to find a link from yourself to a professional-level player. Use your own knowledge of who you played, and the website of wherever it is you play your games - USCF, FIDE, etc., to find who you played and who your opponents played. High rated players tend to play other high rated players a lot, so looking at your higher rated opponents first is often the best way to go.</p></li>
  <li><p>Once you get to someone rated high enough to be in databases, use WinChain. But remember that it only finds wins. Try swapping the names; sometimes that gives a shorter path, since a loss from one perspective is a win from another. And remember that WinChain won't find everything; you may still have to look elsewhere for more direct links.</p></li>
  <li><p>When using WinChain, instead of just searching for Morphy (which might result in a chain that's too long for it to find, or a false positive from some 1800s simul) search for several other players with known Morphy numbers, like Ivkov or Keres. </p></li>
  <li><p>Don't give up. Keep looking until you find that connection.</p></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-10T05:11:12.370Z
Answers.LastActivityDate: 2020-06-10T05:11:12.370Z
Answers.UserDisplayName: D M
Answers.Body: <p>Morphy numbers are something new to me. </p>
  
  <p>It is the degrees of detachment little world marvel for chess players. </p>
  
  <p>I was looking Gligoric and discovered he had a Morphy number of 3. </p>
  
  <p>So Morphy (1837-1884) has a Morphy number zero. </p>
  
  <p>Any individual who played him has a Morphy number of 1. </p>
  
  <p>Any individual who played a Morphy number 1 has a Morphy number 2, etc. </p>
  
  <p>I played John Littlewood in a simul. </p>
  
  <p>John Littlewood had played Botvinnik who has an MN of 3. </p>
  
  <p>That gives me an MN of 5. </p>
  
  <p>Anand, Kramnik, and Gelfand additionally have MNs of 5. </p>
  
  <p>Little world I have just 5 degrees of partition from Morphy who was conceived in 1837.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-01T11:07:45.813Z
Answers.LastActivityDate: 2020-01-01T11:07:45.813Z
Answers.UserDisplayName: eanything indian
Answers.Body: <p>There is no magical way of finding it, of course, you just have to know the history of the people that you have played and then you can deduce your Morphy number. Of course, it is highly likely that the chain never reaches Morphy.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-31T02:19:46.870Z
Answers.LastActivityDate: 2019-12-31T02:19:46.870Z
Answers.UserDisplayName: SubhanKhan
Body: <p>The <a href="https://en.m.wikipedia.org/wiki/Morphy_number" rel="nofollow noreferrer">Morphy number</a> is a measure of how closely a chess player is connected to Paul Morphy (1837–1884) by way of playing chess games. It's analogous to the <a href="https://en.m.wikipedia.org/wiki/Erd%C5%91s_number" rel="nofollow noreferrer">Erdős Number</a> for mathematicians.</p>
  <p>People who played a chess game with Morphy have a Morphy number of 1. Players who did not play Morphy but played someone with a Morphy number of 1 have a Morphy number of 2. People who played someone with a Morphy number of n have a Morphy number of n+1.</p>
  <p>In my case, in the early 1980s, I played Jonathan Penrose in a simultaneous exhibition, the cosmic significance of which was unknown to me at the time. Penrose is one of the few living MN3 players, having <a href="https://www.chessgames.com/perl/chessgame?gid=1156232" rel="nofollow noreferrer">played Savielly Tartakower in 1950</a>, who <a href="https://www.chessgames.com/perl/chessgame?gid=1455250" rel="nofollow noreferrer">played James Mortimer in 1907</a>, who <a href="https://chesscafe.com/the-skittles-room/morphy-numbers-revisited/" rel="nofollow noreferrer">played Paul Morphy himself &quot;hundreds of times&quot; from 1853</a>. So that gives me MN4. A bit lucky: if I hadn't got that connection to Penrose, I might be hard-pressed to find my number.</p>
  <p>Jonathan’s brother is the celebrated physicist, Roger Penrose.</p>
  <p>So how does someone go about finding their Morphy number more systematically? Has anyone data-mined chess games databases from this perspective? Have any results been published? What are the paths implied in <a href="https://en.m.wikipedia.org/wiki/Morphy_number" rel="nofollow noreferrer">the Wikipedia article linked above</a> from the MN1 to MN2 to ... to MN5 players listed there? And what's the expected MN for an active player today?</p>
  <p>Has anyone else here managed to figure out their MN?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-04T10:47:58.423Z
Comments.Text: please play me so I can have MN5. begin. e4. (whatever move you make i'll resign. just make a move please.)
Comments.UserDisplayName: BCLC
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-04T12:47:23.183Z
Comments.Text: @BCLC I am honoured but I think it should be a proper game of chess :-)
Comments.UserDisplayName: Laska
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-04T14:24:05.217Z
Comments.Text: Come on. Please just comment back e5 or something.
Comments.UserDisplayName: BCLC
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-04T14:36:47.640Z
Comments.Text: (part1) This is a half request and half implicit comment about how this number seems, at least ostensibly, kinda weird? i mean, erdos, bacon and erdos-bacon make sense because you actually do work. i mean, not just anyone can act or do maths. morphy number is like all you have to do is play?
Comments.UserDisplayName: BCLC
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-04T14:38:21.797Z
Comments.Text: (part2) anyone can just show up, move and then resign. i think it would make sense if you win (or at least draw) against someone with morphy number (and then MN1 means win or draw against morphy) or make it to X number of moves without losing or something. myb add that it has to be in a FIDE or whatever tournament. but seriously just playing? i don't really see the value in this kind of number.
Comments.UserDisplayName: BCLC
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-06T16:38:40.967Z
Comments.Text: For me, it was easy. I once played against Hans Ree in a simul, and the Wikipedia article listed him as having MN 4, giving me MN 5. I know my Erdős Number (3), but I'm afraid my Bacon Number is infinite.
Comments.UserDisplayName: Abigail
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-07T04:45:05.320Z
Comments.Text: @BCLC 1. … c6 my favourite opening
Comments.UserDisplayName: Laska
Tags: <history><database><morphy>
Title: How can someone find their Morphy number?
ThreadText: # How can someone find their Morphy number?
  
  (Asked by: username_0 on 2019-12-31)
  
  The [Morphy number](https://en.m.wikipedia.org/wiki/Morphy_number) is a measure of how closely a chess player is connected to Paul Morphy (1837–1884) by way of playing chess games. It's analogous to the [Erdős Number](https://en.m.wikipedia.org/wiki/Erd%C5%91s_number) for mathematicians.
  
  People who played a chess game with Morphy have a Morphy number of 1. Players who did not play Morphy but played someone with a Morphy number of 1 have a Morphy number of 2. People who played someone with a Morphy number of n have a Morphy number of n+1.
  
  In my case, in the early 1980s, I played Jonathan Penrose in a simultaneous exhibition, the cosmic significance of which was unknown to me at the time. Penrose is one of the few living MN3 players, having [played Savielly Tartakower in 1950](https://www.chessgames.com/perl/chessgame?gid=1156232), who [played James Mortimer in 1907](https://www.chessgames.com/perl/chessgame?gid=1455250), who [played Paul Morphy himself "hundreds of times" from 1853](https://chesscafe.com/the-skittles-room/morphy-numbers-revisited/). So that gives me MN4. A bit lucky: if I hadn't got that connection to Penrose, I might be hard-pressed to find my number.
  
  Jonathan’s brother is the celebrated physicist, Roger Penrose.
  
  So how does someone go about finding their Morphy number more systematically? Has anyone data-mined chess games databases from this perspective? Have any results been published? What are the paths implied in [the Wikipedia article linked above](https://en.m.wikipedia.org/wiki/Morphy_number) from the MN1 to MN2 to ... to MN5 players listed there? And what's the expected MN for an active player today?
  
  Has anyone else here managed to figure out their MN?
  
  **Tags:** history, database, morphy
  
  > **Comments:**
  > **username_1**: please play me so I can have MN5. begin. e4. (whatever move you make i'll resign. just make a move please.)  
  > **username_0**: @username_1 I am honoured but I think it should be a proper game of chess :-)  
  > **username_1**: Come on. Please just comment back e5 or something.  
  > **username_1**: (part1) This is a half request and half implicit comment about how this number seems, at least ostensibly, kinda weird? i mean, erdos, bacon and erdos-bacon make sense because you actually do work. i mean, not just anyone can act or do maths. morphy number is like all you have to do is play?  
  > **username_1**: (part2) anyone can just show up, move and then resign. i think it would make sense if you win (or at least draw) against someone with morphy number (and then MN1 means win or draw against morphy) or make it to X number of moves without losing or something. myb add that it has to be in a FIDE or whatever tournament. but seriously just playing? i don't really see the value in this kind of number.  
  > **username_2**: For me, it was easy. I once played against Hans Ree in a simul, and the Wikipedia article listed him as having MN 4, giving me MN 5. I know my Erdős Number (3), but I'm afraid my Bacon Number is infinite.  
  > **username_0**: @username_1 1. … c6 my favourite opening  
  
  ---
  
  ## 9 answers
  
  ### Answer by username_3 on 2019-12-31. Score: 10
  
  You'd have to find a list of players Morphy has played. Then, you'd research as many players who played each of those players. This can all be done by searching by player in a large database. Eventually you'd have a large tree, and the problem comes down to an optimal search algorithm.
  
  You'd search "branches" with a more likely chance of giving you a small Morphy number. This means looking at players who have played more games over their career. For example, if some player A was one of Morphy's opponents who played the most games, you'd look at him first. Then, find one of Player A's opponents (call him B) who played the most games in his lifetime, and look at him first. If doing this recursively with B never leads to you (or gives a poor Morphy number), go on to C: the opponent of player A who played the second most games. If eventually you find all of Player A's opponents don't lead to you, meaning Player A isn't connected to you, go on to the opponent of Morphy who had the second most games.
  
  But it's still a massive job to search. Even if you find a link to yourself, you need to prove/justify that it's the smallest link. Perhaps you could organize all these players into a tree and write a program to efficiently search it.
  
  
  ---
  
  ### Answer by username_4 on 2019-12-31. Score: 8
  
  I never heard of the 'Morphy number' until I read your post. I found that my Morphy number is 5. Here is how I did it.
  
  I started with [Wikipedia](https://en.wikipedia.org/wiki/Morphy_number)
  
  After looking at the list I realized that my best bet was the simul where I played John Donaldson. I still regret not pushing the pawn after preparing it so well...
  
  I looked at other American players John would have played and found that he played Reshevsky at [Lone Pine 1981](https://www.365chess.com/players/John_W_Donaldson/?p=1&start=600).
  
  Per Wikipedia Reshevksy's number is 3.
  
  
  ---
  
  ### Answer by username_5 on 2019-12-31. Score: 5
  
  I had a similar problem not long ago, though not chess related. If I were to pattern this solution off of that one, I would consider storing Morphy in an SQL table along with all of his opponents, along with all of their opponents, and so on, in a parent/child relationship. So you would have one table with two columns (id and parent\_id). id would be the child of parent\_id and any id could be a parent\_id, child id or both. So if Morphy is `parent_id=1` and he played ids 2-10, you might have
  
  ```
  parent_id  |  id
  1          |  2
  1          |  3
  1          |  4
  
  etc.
  
  2          |  25
  2          |  28
  
  etc.
  
  ```
  
  The last row would be you. Perhaps you are `id=1,100,000`
  
  ```
  1,000,000  |  1,100,000
  
  ```
  
  Say this table is call chess\_players, you could then recursively query this table to get your id and all of your ancestor parent\_ids. Something like this
  
  ```
  with recursive cte (id, name, parent_id) as
  (
   select     id,
              parent_id
   from       chess_players
   where      parent_id = 1 and id=1100000 -- Morphy is the parent and you are the child
   union all
   select     p.id,
              p.parent_id
   from       chess_players p
   inner join cte
           on p.parent_id = cte.id
  )
  select * from cte;
  
  ```
  
  You will then see all of the parent\_ids of your id number all the way up to Morphy's parent\_id of 1. I suppose this is your Morphy count and you could use this technique for anyone in your chess\_players table.
  
  I'm thinking you could probably scrape a database like [chessgames.com](https://chessgames.com) to populate your table.
  
  
  ---
  
  ### Answer by username_6 on 2020-01-01. Score: 4
  
  As far as an algorithmic answer goes, if you can get a set of games into a pandas dataframe (Python), the following code should get you the Morphy numbers, unless I've messed up somewhere:
  
  ```
  def get_distances(games, 
                    starting_player = 'James Morphy', 
                    max_depth = 100,
                    white_col_name = 'white'
                    black_col_name = 'black')
      player_nums = {starting_player:0}   
      games_left = pd.DataFrame(index = games.index)
      games_left[['white','black']] = games[[white_col_name, black_col_name]]
      for current_depth in range(max_depth):
          known_players = set(player_nums.keys())
          numbered_white = games_left.white.isin(known_players)
          numbered_black = games_left.black.isin(known_players)
          new_white = games_left.loc[numbered_black & (~numbered_white)]            
          new_black = games_left.loc[numbered_white & (~numbered_black)]
          new_players = set(new_white.white).union(set(new_black.black))
          if not new_players:
              return {'player_nums': player_nums, 
                      'result': 'Ran out of connections'}
          for player in new_players:
              player_nums[player] = current_depth+1
          games_left = games_left.loc[~(numbered_white | numbered_black)]
          if games_left.shape[0] == 0:
              return {'player_nums': player_nums, 
                      'result': 'Analyzed all games'}
      return {'player_nums': player_nums,  
              'result':  'Reached maximum depth'}
  
  ```
  
  This gets the Morphy number for everyone. Getting just yours is "almost as hard" (for some definition of "almost as hard") as getting all the Morphy numbers. This gets the numbers for a fixed data set. If you want to update the numbers as more games are played, you can just keep rerunning the program, but there's probably some tweaks you can make to make updating more efficient. Also, there have been comments suggesting people think that calculating the Morphy number would have an exponential complexity with respect to the depth number, but as long as the number of games is fixed, this algorithm has polynomial complexity with respect to the number of games.
  
  More information here: <https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm>
  
  
  ---
  
  ### Answer by username_7 on 2020-03-28. Score: 3
  
  This may not help if you do not have games in the ChessBase database (or even enough games), but ChessBase recently released a feature called "WinChain", which TRIES to find your "number" to any player, including Morphy. Nevertheless, I found that it still does not work particularly well for going back that far, but you still might be interested.
  
  Here is an article called "[Three Steps to Morphy](https://en.chessbase.com/post/three-steps-to-morphy)" discussing the feature.
  
  And here is a [link](https://players.chessbase.com/en/winchain?SrcFirst=&SrcLast=&DestFirst=paul&DestLast=morphy) to the page specifically for the Morphy number.
  
  I could not get my Morphy number since my chain was still too long, but I was only four steps from Kasparov, Karpov and Carlsen, and 5 from Fischer.
  
  [![enter image description here](https://i.sstatic.net/XZsOt.png)](https://i.sstatic.net/XZsOt.png)
  
  
  ---
  
  ### Answer by username_8 on 2020-01-02. Score: 3
  
  Pseudocode to iteratively compute morphy number.
  
  assume you have a database with a table plays of two columns x and y where a row indicates two indeviduals who have played one another.
  
  ```
  _morphy = {}
  def Morphy(name):
  
     if name == 'Morphy':
        return 0
  
     if name in _morphy:
        return _morphy[name]
  
     _morphy[name] = math.inf
     score = math.inf
     results = execute(select x, y from plays where x=name or y=name)
     for x, y in results:
        if x == name:
           score = min(score, Morphy(y) + 1)
        elif y == name:
           score = min(score, Morphy(x) + 1)
  
     _morphy[name] = score
     return score
  
  print(Morphy('Jar Jar Binks'))
  
  ```
  
  
  ---
  
  ### Answer by username_9 on 2020-06-10. Score: 2
  
  For me, it was a combination of Wikipedia, WinChain, USCF, and my own knowledge. I worked from both ends.
  
  I started by assuming that getting a link to high-rated players was probably the way to go - if you follow the chain up, eventually you get to famous players with known Morphy numbers, or at least players who have many games in large databases. To that end, I used the USCF website to find my top opponents (using the "Show Game Statistics" link on the Member Detail page, which organizes opponents by rating.) The choice seemed easy: I've only played one IM in my life. I then looked at his top opponents, followed by *their* top opponents. At that point I lucked out and found a name from the Wikipedia page - Borislav Ivkov, listed as having a rather low Morphy number of 3. So that gave me a Morphy number of 6. I double-checked some other paths, but nothing beat that link.
  
  Of course, I wasn't satisfied with just playing Morphy. I had to beat him. So, I used the USCF website to find the top players I'd beaten, and the top players they beat. This time I used a shortcut: I knew that a particular player that I had once beaten had scored a win against that IM I played. When I checked the Game Statistics, I found that she had also beaten a second IM. I then used the [WinChain](https://players.chessbase.com/en/winchain) tool mentioned in another answer to try to link those two IMs to some players with low Morphy numbers (there were too many false positives if I tried to chain them directly to Morphy.) I also found a somewhat recent game using the USCF Game Statistics pages that wasn't in the database that WinChain uses, which shortened the path by one. Surprisingly, the win path ended up with *no* names in common with the ones that formed my original Morphy number path. I ended up beating Morphy in 7 steps by going through Arnold Denker.
  
  Based on this experience, my tips are:
  
  * First, try to find a link from yourself to a professional-level player. Use your own knowledge of who you played, and the website of wherever it is you play your games - USCF, FIDE, etc., to find who you played and who your opponents played. High rated players tend to play other high rated players a lot, so looking at your higher rated opponents first is often the best way to go.
  * Once you get to someone rated high enough to be in databases, use WinChain. But remember that it only finds wins. Try swapping the names; sometimes that gives a shorter path, since a loss from one perspective is a win from another. And remember that WinChain won't find everything; you may still have to look elsewhere for more direct links.
  * When using WinChain, instead of just searching for Morphy (which might result in a chain that's too long for it to find, or a false positive from some 1800s simul) search for several other players with known Morphy numbers, like Ivkov or Keres.
  * Don't give up. Keep looking until you find that connection.
  
  
  ---
  
  ### Answer by username_10 on 2020-01-01. Score: 2
  
  Morphy numbers are something new to me.
  
  It is the degrees of detachment little world marvel for chess players.
  
  I was looking Gligoric and discovered he had a Morphy number of 3.
  
  So Morphy (1837-1884) has a Morphy number zero.
  
  Any individual who played him has a Morphy number of 1.
  
  Any individual who played a Morphy number 1 has a Morphy number 2, etc.
  
  I played John Littlewood in a simul.
  
  John Littlewood had played Botvinnik who has an MN of 3.
  
  That gives me an MN of 5.
  
  Anand, Kramnik, and Gelfand additionally have MNs of 5.
  
  Little world I have just 5 degrees of partition from Morphy who was conceived in 1837.
  
  
  ---
  
  ### Answer by username_11 on 2019-12-31. Score: 1
  
  There is no magical way of finding it, of course, you just have to know the history of the people that you have played and then you can deduce your Morphy number. Of course, it is highly likely that the chain never reaches Morphy.
  
  
  ---
  
  