From ba0dc096ac219e739098b9b6ab71bf7a7007c444 Mon Sep 17 00:00:00 2001 From: Jonathan Vanhaaften <40076195+Jonathanvanhaaften@users.noreply.github.com> Date: Sun, 31 Oct 2021 13:53:32 -0600 Subject: [PATCH] compare scrabble word scores --- scrabblewtests.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 scrabblewtests.c diff --git a/scrabblewtests.c b/scrabblewtests.c new file mode 100644 index 0000000..8df59bd --- /dev/null +++ b/scrabblewtests.c @@ -0,0 +1,76 @@ +#include +#include +#include +#include + + +// Points assigned to each letter of the alphabet +int POINTS[] = {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}; + +int compute_score(string word); + +int main(void) +{ + // Get input words from both players + string word1 = get_string("Player 1: "); + string word2 = get_string("Player 2: "); + + // Score both words + int score1 = compute_score(word1); + int score2 = compute_score(word2); + + printf("Player1: %i Player2: %i\n",score1,score2); + + // TODO: Print the winner + if(score1>score2){ + printf("Player 1 wins!"); + }else if(score1=65 && test<=90){ + + printf("ascii value %i\n",test); + + charnum = test-65; + + printf("ascii -65 :%i\n",charnum); + + score = score + POINTS[charnum]; + + + } + + + printf("score sum: %i\n",score); + + i++; +} + + + // TODO: Compute and return score for string + return score; +}