Word ladder Problem


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Word ladder Problem
# 1  
Old 04-03-2018
Word ladder Problem

Perl - Script

Rules
In a Word Ladder:

Players get a starting word and an ending word
Starting and ending words must be the same length (PIG and HOG, or CAT and DOG)
Players change one letter at a time, attempting to move from the starting word to the ending word
Each intermediate step must be a valid word, and no proper nouns allowed!
Examples
Here are a few samples. Note that each step is a word and changes only one letter from the previous word.

FLY to CRY
Get from FLY to CRY in one step.

FLY
FRY (l → r)
CRY (f → c)
CAT to DOG
Turn a CAT into a DOG in two steps.

CAT
COT (a → o)
DOT (c → d)
DOG (t → g)

Note: Without using any modules.

Regards,
asak.

---------- Post updated 04-03-18 at 10:42 AM ---------- Previous update was 04-02-18 at 07:32 PM ----------

any solutions?
# 2  
Old 04-03-2018
Quote:
Originally Posted by asak

any solutions?
Yes: do your homework - yourself! If you need help for homework/coursework please use the special board for that. Notice that special rules apply there.

This thread is closed.

bakunin
This User Gave Thanks to bakunin For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Snake and ladder game

Hi, I am designing snake and ladder game in unix. I am writing my script in bash shell in Solaris version. This game is designed by me for which I would like to give access to two players. When these players execute the game, there should be communication between the three participants(game... (7 Replies)
Discussion started by: ayarlaga
7 Replies

2. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

3. Shell Programming and Scripting

problem removing a word from a file in vi

lets say i have a file named ex1 which contain an essay. (a) delete the word "benefit" from the file (b) delete the last 6 characters on each line for the first problem i entered :g/benefit/d but it deletes the whole line please help (3 Replies)
Discussion started by: koricha
3 Replies

4. Shell Programming and Scripting

Perl code- word count problem

Hi, I am having .csv files contains some row - Info: Value of field name 'SecurityExchange' is not supported ","Original Order Tuple Please see the below perl code carefully- /Info: (+),Original (\w+) Tuple/ and do { ($category, $type) = ($1, $2); if($type eq 'Execution')... (1 Reply)
Discussion started by: pspriyanka
1 Replies

5. Shell Programming and Scripting

Exclude specific word from input file problem asking...

Hi, Below is my input file and desired output file: Input file: >header_N_1 ASFDGDGNDGEGWETWRYWTETWNETOWETWETWNETTETNWET . . Desired output file: >header_N_1 ASFDGDGDGEGWETWRYWTETWETOWETWETWETTETWET . . From the input file, I just hope to exclude the 'N' word from its content... (5 Replies)
Discussion started by: patrick87
5 Replies

6. Shell Programming and Scripting

Remove specific word from data contents problem asking

Hi, Below is my input file: >tempZ_1 SAFSDAFDSG GGERRTTZZZ ZASRARARET WETPOASDAZ ZZZASASFAS >temp_9 ASAEGPIOEO EIOPIZZZAS FDFGZZZARA ESEAZZZAAS . . Desired output file: (9 Replies)
Discussion started by: patrick87
9 Replies

7. Homework & Coursework Questions

word ordering problem HELP please (linux)

Hi guys I need you ,please help me i have to do this for tomorow and i don't understand how to do Q1 : Order the words of RADIO.txt by frequency Q2 : Order the words of RADIO.txt in alphabétique order Q3 : Order the words of RADIO.txt par ordre "rhymique" (exemple, put togeder words which are... (1 Reply)
Discussion started by: Lili
1 Replies

8. UNIX for Dummies Questions & Answers

word too long..problem while sourcing .cshrc

I am setting my PATH & LD_LIBRARY_PATH through .cshrc file while sourcing it on a old shell i am getting the error word too long .and the changes which i anm doing doesn't get updated . i am in a multi user environment so the only way to do the changes only for my shell is to do it that way. ... (1 Reply)
Discussion started by: mobydick
1 Replies

9. UNIX for Dummies Questions & Answers

Word count problem

I have a text file that has 5719 rows when I open it up in a text editor. When I do a wc -l in Unix however, it says that I have 5718 rows. What could be causing this difference? (1 Reply)
Discussion started by: ssmith001
1 Replies

10. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
Login or Register to Ask a Question