Sha256: f778bd41cc841962f61ce30a391b7fc103aa8ae46f0ee1da1a654196c168e4e2

Contents?: true

Size: 444 Bytes

Versions: 228

Compression:

Stored size: 444 Bytes

Contents

#include "scrabble_score.h"
#include <ctype.h>

static unsigned int score_book[] = {
   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
};

unsigned int score(const char *word)
{
   char c;
   unsigned int word_score = 0;

   while ((c = tolower(*word++)) != '\0') {
      word_score += score_book[c - 'a'];
   }

   return word_score;
}

Version data entries

228 entries across 228 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.158 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.157 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.156 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.155 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.154 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.153 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.152 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.151 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.150 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.149 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.148 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.147 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.146 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.145 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.144 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.143 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.142 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.141 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.140 tracks/c/exercises/scrabble-score/src/example.c