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.119 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.118 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.117 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.116 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.115 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.114 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.113 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.111 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.110 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.109 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.108 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.107 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.106 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.105 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.104 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.103 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.102 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.101 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.100 tracks/c/exercises/scrabble-score/src/example.c
trackler-2.2.1.99 tracks/c/exercises/scrabble-score/src/example.c