# Creating A Scrabble Game Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Scrabble is a world building multiuser game that consists of tiles which are distributed to the players. Scrabble game can have two to four players and the ultimate objective is to form crosswords on the scrabble board.

The game board consists of mainly two parts namely: There are 100 tiles available in which 98 of them are marked tiles which are alphabets from A-Z and two anonymous letters and each alphabet is given a score and a blank letter is given 0 points.

Course of the game:

The players are initially given a rack with seven letters known as tiles placed on a rack which can be exchanged from the bag which already consists of the tiles that act as warehouse for storing the letters. To frame a word on the scrabble board, we should place a tile from the rack connecting at least single tile which is already placed on the board. New tiles will be placed on the rack from the sack, based on the number of tiles placed on the board. Each letter will have different point value, so the game strategy is to play words with high scoring letter combinations.Â  This means forming a word with high frequency tiles scores less than forming a word with less frequency tiles, such as Q, Z, and X.

Access to dictionary with logical implementation will be used that uses an Internal Dictionary to check whether the words formed by the players are valid or not. For each Player there will be time limit to place the word on the board if in case a player failed to place the word on the board in time the chance will now shifted to the opponent player or a player can "Pass" his chance to opponent. Also we will have another way that when a player click on "exchange" button (for this the player will be given 0 points)it will performs two activities: Firstly it replaces the set of tiles on the rack/stand with new set of tiles and then it will give the turn to the opponent player. If an individual used all his 7tiles on the rack at a time he will be awarded bonus points.

Project Aim:

To play the scrabble game against a human player, and perhaps against other machines.

Project Objective:

The main objective of this game is to score more points than the opponent and also make sure that playing scrabble should be more tactical for the opponents especially when playing against computer.

Key challenges of the Project:

To understand and analyze game playing algorithms like Direct Acyclic Word Graph (DAWG) Algorithm, GADDAG Algorithm and Random Number generation Algorithm.

To use dictionary which will be useful for validating the words placed on the board.

Designing a Graphical User Interface (GUI) mode web application to make the game more user interactive and user friendly.

Requirements of the Project:

Java technology (Java Server Pages or Swings)

Dictionary to be saved in a text file or a data base.

Optional:

Tomcat server , if working on web application of scrabble

Help button is provided

Research and Background:

As we need to understand the game playing algorithms like DAWG, GADDAG for move generation phase and Random Number Generation (RNG) algorithm for generating random letters/tiles on the rack, let us discuss these algorithms briefly.

DAWG Algorithm:

DAWG is the short-form of Direct Acyclic Word Graph algorithm, states that the problem has to be reduced one-dimensional, which means instead of scanning through the entire lexicon for playable words, it is better to identify the words on the board for spaces where we can start building a new word using the tiles on the rack connecting the existing ones on the board. For this we use data structures to make the search one-dimensional.

Lexicon Representation:

Lexicon representation is the key element of the algorithm, which makes the search faster. We represent lexicon as a tree whose edges are labeled by letters, each lexicon has a root node and have many nodes in the path of a lexicon. The node at which words path is terminated/ended is called terminal node.

Backtracking:

As we know that Backtracking algorithms are based on depth-first recursive search. Here we uses a two-part strategy for a word to be placed on board: if the left side of anchor is a blank space/square then we have to place a letter/tile on that blank square from our rack and move to rightwards to check if it form a word.else, if the left side of the anchor is not a blank square we simply move to the right side to form a word.

By using this algorithm would produce saving in space

Efficiency increases due to Back tracking search strategy

Using Backtracking search strategy, the checks for valid words and cross will be reduced

Representation of Lexicon as DAWG is its compactness

Limitations:

The representation of the lexicon allows the words to traverse leftwards or rightwards. There can be hints that would be placed or shown to the player using the technique of hashing or indexing of the entire board. However, the logic of heuristic functions are not used in the move generation prediction and moreover, it also does not support to keep the tiles in the racks for making a good combination which would yield a good score.

It is a fast algorithm that avoids the limitations discussed in the DAWG algorithm by determining the prefix move generation for yielding good score with big combinations of letters. The deterministic algorithm uses the two way directions termed as bidirectional path on either side of the lexicon of each word. The functionality of GADDAG algorithm is to generate every possible move with the letters on the rack based on the anchor square using the technique of backtracking, recursive routines. The method used for Gen (0, NULL, RACK, INIT) which determines INIT parameter that represents the initial state of GADDAG. The method Gen is direction independent either leftward or rightward direction. Another method for move generation, GoOn determines the side (left or right) where the letter needs to be placed connecting with the letter on the board already present.

Random Number Generation Algorithm:

The algorithm is used when the user wants to exchange his entire rack of 7 letters with a new set of letters from the bag. The user when tries to click the exchange button, this algorithm needs to run generating the different random letters given to the user for forming a word in his next turn as mentioned in the course of the game. This algorithm can be implemented in several ways by using the function Math.random () that generates numbers between 0 and 1. As the letters need to be generated, they can be converted to characters by multiplying with 26 which represents the number of alphabets.

Technical Specifications:

A scrabble board will be designed with the help of swings or Java Server Pages to form a 15*15 tiles board. The board that consists of tiles need to be filled with letters which are represented as images that have score for each corresponding letter. All the letters are stored in a database which can be retrieved from the database using the concept of JDBC (Java Database Connectivity). While placing the tiles the concept of counter decrementing or incrementing is used for keeping the timer. Java Server Pages helps the user to design certain web applications in the form of static and dynamic components. The features of JSP technology include constructs that would be used for accessing server side objects and the code is written in text based documents that consists of the responses and requests from and to the server respectively. Swings provide multiple platform independent interfaces that may interact the users and GUI components. These APIs can be imported from the package "import javax.swing.*;" JDBC: is a Java API that can be used in accessing tables and entities which are stored in a relational database. These coding and technical specifications can be implemented in user friendly interfaces namely Eclipse or NetBeans IDE software where the code can be written to make easier manner of implementation (Source: http://java.sun.com)

PROJECT PLAN:

July

August

September

Wk1

Wk2

Wk3

Wk4

Wk5

Wk6

Wk7

Wk8

Wk9

Wk10

Wk11

Wk12

Introduction

## Â

Literature Review

## Â

Requirement Analysis

Design

Implement

Phase

Testing Phase

First Draft

Final Submission