Scrabble word scoring I have a Scrabble game program which takes two players' words and calculates who has the winning score.
Whichever player has the highest score is the winner; there's a tie if the scores are the same.
It all seems to work how I have written it; however I am sure it can be done better. Just wondering if anyone could give me some ideas on a more efficient way to write this?
#include &lt;ctype.h&gt;
#include &lt;cs50.h&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;

// Points assigned to each letter of the alphabet
int points[] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10};


int compute_score(string word);

int main(void)
{

    // Get input words from both players
    string word1 = get_string(&quot;Player 1: &quot;);
    string word2 = get_string(&quot;Player 2: &quot;);

    // Score both words
    int score1 = compute_score(word1);
    int score2 = compute_score(word2);

    // TODO: Print the winner
    if (score1 &lt; score2)
    {
        printf(&quot;Player 2 wins!...&quot;);
    }
    else if (score1 == score2)
    {
        printf(&quot;Tie!&quot;);
    }
    else
    {
        printf(&quot;Player 1 wins!...&quot;);
    }
}

int compute_score(string word)
{
    // TODO: Compute and return score for string
char letters[26];
int asciiletter = 97;
int score = 0;
int i = 0;
int k = 0;


    for (i = 0; i &lt; 26; i++)
    {
        letters[i] = asciiletter + i; 
        
        
    }

    
    //Get the chars in the string of word and compare to all letters in alphabet letters[26]
    for(int j= 0, n = strlen(word); j &lt; n; j++)
    {
        //if entered values uppercase, convert to lower as points are the same for either case
        word[j] = tolower(word[j]);
        for(k = 0; k &lt; 26; k++ )
        {
                if (word[j] == letters[k])
                {
                    score = score + points[k];
                }
        }
    

    }
    return score;
}
and welcome to C programming! Also, to Code Review.
Style
There are a couple of &quot;style&quot; issues with your code. The most obvious one is that your indentation is not consistent. I don't know if that's due to pasting it into the browser, or if it appears that way in your code. But computescore needs to be cleaned up.
Next is an issue of &quot;comprehensibility&quot;. You have this array:
// Points assigned to each letter of the alphabet
int points[] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10};

Quick, how many points for 'S'?
This array might possibly be correct, but it's not comprehensible and it's not modifiable. It would be much better to provide some other mechanism to initialize the array, or initialize some other structure, such that the next guy to maintain the code has a chance of seeing bugs and/or being able to make changes.
For example:

You might create an enum, with point values for each letter, then initialize the array using the enum labels:
enum {
    A_POINTS = 1,
    B_POINTS = 3,
    C_POINTS = 3,
    :
};

int points[] = {
    A_POINTS,
    B_POINTS,
    C_POINTS,
    :
};


You might create a clever designated initializer macro that makes things more clear:
#define TILE(CH) [CH - 'a']

int points[] = {
    TILE('a') = 1,
    TILE('b') = 3,
    TILE('c') = 3,
    :
};


You might consider building a string and parsing it at runtime, like:
const char * points = 
     &quot;A = 1; B = 3; C = 3; ...;&quot;
     &quot;N = ...&quot;
     ;



Be aware: the point of this is purely to make it easy to understand the mapping between letters and points. Ideally, you want to make it easy enough to understand that someone could look at the code and catch a mistake before you compiled it and went to testing.
Magic
Your scoring function searches through a list of characters in order to obtain the index of a particular character. Never do that! You know the index, it's just hidden behind a thin layer of mathematics.
In ASCII, the upper and lowercase letters (also, digits) are runs of encoding values assigned in consecutive, increasing order. Once you know where the start of the run is, you can get to any other character by simple addition. Likewise, you can reverse that trick using simple subtraction:
    score_index = ch - 'a';
    score += points[score_index];