Cryptic crosswords - create a simple command line program

Assignment Help Programming Languages
Reference no: EM13302882

BACKGROUND

When doing cryptic crosswords, two problems often arise.

1. Letter Patterns

You cannot work out the clue but know a number of letters because of other words intersecting with the one you want to figure out.
For example, the clue might be "left handed" and you know the following pattern of letters

_O_T_P_W

The underscore represents the letters you don't know. See if you can figure it out. The answer is given further down.

2. Anagrams

In cryptic crosswords you have to decipher the clue to determine the word. One of the standard tricks of cryptic crossword creators is to use anagrams. That is, taking a word or set of words and rearranging the order to get a new word.

For example

Gale is going haywi re with the fodder storage

The says the answer is a single word 6 letters long. The hint here is the word "haywire", which is indicating we have to shuffle letters around to get the answer. "Gal e i s" is six letters long and an anagram of that is "silage", which is the storage of grain and fodder. We have our answer.

Unfortunately, it can often be quite difficult to work out the anagram if it uses a lot of letters and the word we want is obscure.

Create a simple command line program which will help solve these problems.

because decease defense despise genoese genoise pelisse pentose recluse relapse release remorse reprise repulse reverse ventose verbose Number of matching words found = 17

Example 3

Crossword A dict.txt arid

Will produce the following output

arid dari raid Number of matching words found = 3

ASSIGNMENT OBJECTIVES

The purpose of this assignment is to demonstrate competence in the following skills.

Program design

Array and string manipulation

NSFoundation classes including NSString, NSNumber, NSArray, NSMUtableArray

Command line arguments

File handling

Creating methods in Objective C

Creating classes in Objective C

These tasks reflect all the subject objectives.

STARTING THE PROGRAM

Your program must use command line arguments. Assuming your program has been compiled to crossword. exe you would run with the following command line arguments.

Crossword [AIP] dictionary letters

[Al P]
This says we must either supply the letter A or the letter P as part of the command line arguments.

A We are looking for words in the dictionary that are an anagram of the letters supplied.

P We are looking for words in the dictionary that match the pattern of letters supplied.

dictionary

In order to solve the problem you will need a dictionary of words to check your letters against, looking for possible matches. The dictionary will have one word per line of file. As part of the assignment I will supply a dictionary file called di ct . txt, which contains about 64000 words to test against. It can be assumed that the dictionary only contains alphabetical letters. It contains no spaces, digits or punctuation characters.
letters

Letters can be in two forms

1. A set of alphabetical letters. It contains no spaces, digits or other punctuation characters. The letters can be any case. This will be used with the A argument. Your program will find all words in the dictionary that are an anagram of the letters.

2. A set of alphabetical letters and underscores. It contains no spaces, digits or other punctuation characters. The letters can be any case. This will be used with the P argument. Your program will find all words in the dictionary that match the pattern of letters.

OUTPUT

The program will output all the words it finds matching the pattern/anagram plus a count of the words found.

Example 1

Crossword P dict.txt _O_T_P_W

Will produce the following output

southpaw

Number of matching words found = 1

Example 2

Crossword P dict.txt _e_se

Will produce the output

Reference no: EM13302882

Questions Cloud

Determine the required width a of the plate : A steel plate 5/16" thick is embedded in a horizontal concrete slab and is used to anchor a high-strength cable as shown. The diameter of the hole in the plate is 3/4", the ultimate strength of the steel used is 36 ksi
Obtain the activity of the radioactive material : A device used in radiation therapy for cancer contains 6.20×10-1 g of cobalt 2760Co (59.9333819 u). Determine the activity of the radioactive material
Is this a profitable agreement for wrc : If WRC's cost of capital is 12% per year, is this a profitable agreement for WRC?
Determine the allowable load p for the safety factor : a plane truss is subjected to a loads 2P and P at joints B and C, respectively, as shown in figure part a.The truss bars are made of two L102 x 76 x 6.4 stell angles having an ultimate stress tension equal to 390 MPa (cross-sectional are of the tw..
Cryptic crosswords - create a simple command line program : Decipher the clue to determine the word. One of the standard tricks of cryptic crossword creators is to use anagrams
Determine the half-life of this isotope : The isotope 88224Ra of radium has a decay constant of 1.19×10-6 per second. What is the half-life (in days) of this isotope
What is the average accounts receivable figure : Size of Accounts Receivable- Tidwell, Inc., has weekly credit sales of $19,400, and the average collection period is 34 days. The cost of product is 75 percent of the selling price. What is the average accounts receivable figure?
Determine the specfic discharge and average linear velocity : The potentiometric surface elevations at two observation wells 1000 m apart are 52.35 m and 56.90 m. If the horizontal hydraulic conductivity of the auquifer is 25 m/ day determine the specfic discharge, and average linear veolicity of the flow as..
Find the half-life of the material : In 9.00 days the number of radioactive nuclei decreases to one-eight the number present initially

Reviews

Write a Review

Programming Languages Questions & Answers

  Arithmetic and application of summaries

Write some R code that carries out computation, but do it with a single R expression that contains no commas (,) and no braces ({}).

  Write pseudocode for worm moving toward apple

Worm is moving toward an apple. Each time it moves, worm cuts distance between itself and apple by its own body length until worm is close enough to enter the apple. Give pseudocode for this.

  Write program to accept a list of student-s name

Write a program that will accepts a list of student's name, individual scores for quiz1, quiz2 and quiz3. Your program should then compute for the average of 3 quizzes.

  Implement a program that prompts the user for an integer

Implement a program that prompts the user for an integer n and prints the nth Fibonacci number, using the above algorithm.

  Write function which takes a string as the argument

Some examples are: "1234321", "C", "ABCBA". Write down a function which takes a string as the argument and returns 1 if string is palindrome and 0 otherwise.

  Develop the interactive calculator in bash shell script

Develop the interactive calculator completely in bash shell script (Linux programming). This calculator program must have the following features: Entry of expression acceptable to expr

  Threads belonging to same process affected by page fault

Other user user threads belonging to the same process also be affected by the page fault - that is would they also have to wait for the faulting page to be brought into memory? Explain.

  Super call for constructor to allot value of attribute

We have given a super call, which does some work of constructor. Your code must complete constructor by allotting the value of g to gpa attribute.

  Complete a request for system services

Objectives Complete a Request for System Services form, which triggers the preliminary investigation phase. Analyze a user interview and extract pertinent facts, which can be used to assess project feasibility. Complete a Problem Stateme..

  Create unix shell script to input number of hours worked

Create a Unix shell script to input number of hours worked and pay rate and compute the total pay, then the social security amount (assume 5%), then the net pay.

  Write down program to arbitarily choose numbers

Write down a program to arbitarily select the numbers of 3 finalist to recieve a prize. Ensure not to choose same number twice. For instance picking finalist 3, 15, 29 woul valid but picking 3,3,31 would be invalid.

  Write program to create n-dimensional array on th runtime

Write a program to create an n-dimensional array on the runtime with the help of pointers. The user will enter on the run time that how many dimensions are required.

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