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.180 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.179 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.178 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.177 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.176 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.175 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.174 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.173 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.172 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.171 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.170 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.169 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.167 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.166 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.165 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.164 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.163 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.162 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.161 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.160 tracks/c/exercises/scrabble-score/src/example.c