Write a program for the wordscramble game

Assignment Help Programming Languages
Reference no: EM13781143

Given a word scramble and a dictionary of words, find the best possible solutions to each word.

Both the dictionary and the wordscramble are a set of words, one per line. The script should output one or more solutions. An example wordscramble and solution are provided, below.

1. You must provide a hard coded dictionary in your program.

for example, this might be your dictionary: mary twinkle star row your boat gently down the stream life but dream ruby

2. An array of arrays, filled with single characters composing the word may be used.

a = %w[m a r y] #=> ['m', 'a' , 'r', 'y'] or

a = Array ['m' 'a' 'r' 'y'] #=> ['m', 'a' , 'r', 'y']

3. The length of each dictionary word may be useful for starting to unscramble the word.

['m', 'a' , 'r', 'y'].length # => 4

4.Report an error if a word is not the dictionary (i.e cannot be unscrambled).

EXAMPLE:

*******

The scrambled word is: arym

Guess the word....

You have 5 guesses left....

army

Your guess is incorrect. 4 left...

********

The scrambled word is: arym

mary

You got it!

<Y> ti continue ir <N> to stop

N

*******

Game ends!

Reference no: EM13781143

Questions Cloud

Discuss how you would have approached the particular topic : discuss how you would have approached this particular topic if you were to write a middle ground argument, instead of a Toulmin or Rogerian argument.
Problems related to theology and philosophy : What are the similarities and differences between your personal beliefs about God and the accounts of God we have studied this week?
Help on pc desk : You are the Chief Information Officer (CIO) of a medium sized business that provides an online data base to Internet subscribers. By then end of the current business quarter, you must propose a design for the implementation of client operating sy..
Language and forms of cultural organization : Based on your reading about language and forms of cultural organization, please write a brief essay of 2 pages answering the following questions:
Write a program for the wordscramble game : Both the dictionary and the wordscramble are a set of words, one per line. The script should output one or more solutions. An example wordscramble and solution are provided, below.
Distinguish technical efficiency from economic efficiency : Distinguish the various cost curves and describe the relationships among them - Explain the role of the firm in economic analysis and describe the production process in the short run - Distinguish technical efficiency from economic efficiency.
Explain the structure of the appellate courts in your state : Include in your discussion an explanation of the jurisdiction (authority to hear cases) of these various trial courts. Specifically, explain in what trial court(s) in the state you would file specific types of claims. Additionally, explain the str..
Analyze the basic issues of human biology : In 200-250 words, analyze the basic issues of human biology as they relate to chronic conditions and describe the interaction between disability, disease, and behavior.
Behaviors about a number of conditions including cancer : Our stage of life, intellectual/cognitive abilities, and sociocultural position in life, affect our perspectives and resultant behaviors about a number of conditions including cancer.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a prolog relation subsequence

Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isn't a member of L.

  Compute and display number of miles per hour

Once correct data has been entered, the program muts compute and display number of miles per hour over the speed limit that the driver was doing.

  Compare and contrast object-oriented languages

Compare and contrast object-oriented languages (Java, C++, C#, etc.) to imperative languages (C, Pascal, etc.) in terms of: Programmability Maintainability Performance Development tools Explain the use of scripting languages, such as JavaScript, PHP,..

  Design a flowchart that is also a fully functional program

Using Visual Logic, design a flowchart that is also a fully functional program. According to your design, the program must: Continually accept data regarding the purchase of fruit until a sentinel value is entered.

  Nested if functions along with vlookup function

The Vlookup function returns a #n/a! error if no lookup value is supplied, and various other errors whne invalid keys are entered. Use a combination of three levels of nested if functions, and other functions to avoid these problems.

  Do the second half as a completely separate loop

Do the second half as a completely separate loop. Remember you'll print out "n" number of stars on a line the same way whether you are doing the top half or the bottom half

  Create a simple shell

Create a simple shell. Basically your shell should read the line from standard input, parse the line with command and arguments, and operate the command with arguments.

  Develope a tutoring software for an elementary school

You are the project manger for a company that is planning to develope a tutoring software for an elementary school that will follow their curriculum create a work breadown structure.

  Falling letters game

Generic queue in the first project and generic list in the second project - In the second project, the player clicks the mouse on any falling letter to remove that letter from the window.

  Prepare console application to examine contents of text file

Prepare the C++ console application which examines the contents of a text file. Your program must count the number of: * lines (hint: use getline).

  Explain relationship between xbrl and semantic web

How do HTML 5, RDF (Resource Description Framework), and OWL (Web Ontology Language) relate to the semantic web? Explain the relationship between XBRL and the semantic web.

  Write program to read data of four students from input file

Write C++ program which reads data of 4 students from the input file which name is given by user and displays summary report of students' marks on output file stdMarks.out"

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd