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 program to prompt number of rooms in house

Write down the program which prompts for number of rooms in house. Use input, n, to declare array of rectangles dynamically. In loop, input dimensions for n rooms.

  Prepare a presentation on backgrounds and fonts

Can you still read the text? Is it too narrow or thick? Is an icon hidden by the background? You should also include tips for choosing backgrounds and fonts.

  Write the code using recursive decent parser

Write the code, using recursive decent  parser and write the code, using a table-driven parser

  Create a program that keeps track

Create a program that keeps track of the following information input by the user: First Name, Last Name, Phone Number, and Age. Now - let's store this in a multidimensional array that will hold 10 of these contacts. So our multidimensional arra..

  Create a new class called soda

Create a new class called Soda that is also a caffeinated beverage by default it will have no option for condiments. Have it called in main. Main also calls the old addLemon function on Tea so that the customer gets two lemons. Use an adapter to s..

  Write a program to find a baseball players batting average

Write a program to find a baseball player's batting average. The program should ask the user to enter the number of times the player was at bat and the number of hits he got. It should then show his batting average to four decimal places.

  Create application to enter number of units sold

Quantity discounts are given according: create an application that allows the user to enter the number of units sold for each software package.

  Write the program by using ias instruction set

Using IAS instruction set, write the program for this problem. Ignore fact that IAS was designed to have only 1000 words of storage.

  Enhanced cleverskater

Create an cleverSkater. Use that code as the basis for your World. In addition to the skateForward, spin and skateAround methods, create skateBackward and jump class-level methods.

  Find the date format is valid or not

Display the date and message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid.

  Write a program to compute the volume flow rate in cubic

write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter

  Create a class named rectangle with length and width

To cover that floor with carpet that costs $8 per square foot would cost $960. (12 x 10 x8 = 960.). You should create a class named Rectangle with the following properties:

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