Thread: scrabble counting

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    scrabble counting

    Hello

    I have a question, i have to make a c source file of the game scrabble and then the counting, so you enter a word and the computer count the points.

    But i don't know how to do this.

    Points Letter
    1 A, D, E, I, N, O, R, S, T
    2 G, H, L
    3 B, C, M, P
    4 J, K, U, V,W
    5 F
    6 Z
    8 X, Y
    10 Q

    could someone help me out? thank's

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Make an array that stores each letter of the alphabet, and has a value for each one. Loop through the letters in the word, look them up in your tablet, and sum it all up.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by kees View Post
    Points Letter
    1 A, D, E, I, N, O, R, S, T
    2 G, H, L
    3 B, C, M, P
    4 J, K, U, V,W
    5 F
    6 Z
    8 X, Y
    10 Q
    Out of curiousity, what language is the above?
    Scrabble letter distributions - Wikipedia, the free encyclopedia
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #4
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    scrabble counting

    Thank's for the quick reply.

    I am very new in C, i tried all kinds of things but can't get it working.
    i tried the if-else statement but that doesn't work.
    How can i make an aray of letters ?

    could someone help me out. thank's

    Dave_Sinkula it's a dutch language
    Last edited by kees; 10-03-2009 at 09:17 AM.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    int letters[26] = { 1, 2, 4, 5, ... };
    Something like that.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    scrabble counting

    thanks for the reply

    something like this:

    #include <stdio.h>

    main()
    {
    int letters [26] {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y ,z);

    printf (" give a word:");
    scanf ("%s", & word);

    but how can you make him count all letters?

    i just can't get it working

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Do you know how to use loops? If not, you should find a book or tutorial on them. Then find one on arrays.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reference Counting
    By Dae in forum C++ Programming
    Replies: 10
    Last Post: 08-13-2009, 07:34 AM
  2. How to implement reference counting with 'Smart_ptr'?
    By meili100 in forum C++ Programming
    Replies: 3
    Last Post: 06-10-2007, 05:28 AM
  3. Counting Numbers in Array, not counting last number!
    By metaljester in forum C++ Programming
    Replies: 11
    Last Post: 10-18-2006, 11:25 AM
  4. Scrabble AI
    By vex_helix in forum C Programming
    Replies: 9
    Last Post: 04-03-2004, 03:03 PM
  5. Counting using Lib Cstring
    By niroopan in forum C++ Programming
    Replies: 4
    Last Post: 12-13-2002, 05:51 PM