Monday, February 13, 2017

Scrabble Letters as an Array

What is Scrabble Game?

The word board game "Scrabble" vary in the letter distribution of the tiles, because the frequency of each letter of the alphabet is different for every language. As a general rule, the rarer the letter the more points it is worth. Many languages use sets of 102 tiles, since the original distribution of one hundred tiles was later augmented with two blank tiles. In tournament play, while it is acceptable to pause the game to count the tiles remaining in the game, it is not acceptable to mention how many tiles are remaining at any time. Several online tools exist for counting tiles during friendly play.

Below is the useful information for Scrabble programmers-

List of characters in an scrabble game


 It may vary from language to country, below one is for English:

private String[] charList = { "A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "C", "C", "D", "D", "D", "D", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "F", "F", "G", "G", "G", "H", "H", "I", "I", "I", "I", "I", "I", "I", "I", "I", "J", "K", "L", "L", "L", "L", "M", "M", "N", "N", "N", "N", "N", "N", "O", "O", "O", "O", "O", "O", "O", "O", "P", "P", "Q", "R", "R", "R", "R", "R", "R", "S", "S", "S", "S", "T", "T", "T", "T", "T", "T", "U", "U", "U", "U", "V", "V", "W", "W", "X", "Y", "Y", "Z", };

You can generate it from following two inputs-

String list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int[] count = {9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1};

The above list does not include two blank characters, add them separately.

No comments:

Post a Comment

CDN | Clearing Cloudflare cache

In order to clear Cloudflare cache automatically via code, follow below steps: 1. Develop Custom TransportHandler Develop a custom Trans...