User:Thebigh/mysandbox: Difference between revisions

From Rosetta Code
Content added Content deleted
(start a very rough draft)
(create draft)
Line 1: Line 1:
An evil wizard has trapped you in the stairwell of his castle. Your only hope of escape is to run up all 100 steps to reach the top, and you can run one step per second. Unfortunately the wizard uses magic to lengthen the staircase by five steps per second. The new steps are inserted randomly between existing steps, so if you're lucky some of them might be beneath you and not ahead of you.
A '''crossword''' is a puzzle game consisting of a grid of white and black squares. The white squares must be filled in with letters of the alphabet according to certain clues, such that horizontal rows and vertical columns of letters all form words. Black squares separate the words.


Can you escape, or are you doomed to run up an ever-lengthening staircase forever?
Given a dictionary of words (use unixdict.txt), the length of a word to be searched for, and a list of known letters and their position, write a program to find all words in the dictionary that fit the requirements.


Write a program to simulate your escape attempt. How are you doing after ten minutes? For every second between 600 and 609 seconds inclusive print the number of steps behind you and the number still ahead of you.
* Show all solutions for "Three letter word, first letter D, third letter G"


If you escaped, run 10,000 tests and print the average time taken and the average final length of the staircase.
===Extra credit===

Some "words" are actually phrases of several words with the lengths of each individual word in the phrase given. Search all combinations of words with those lengths for solutions.

Revision as of 19:08, 15 November 2021

An evil wizard has trapped you in the stairwell of his castle. Your only hope of escape is to run up all 100 steps to reach the top, and you can run one step per second. Unfortunately the wizard uses magic to lengthen the staircase by five steps per second. The new steps are inserted randomly between existing steps, so if you're lucky some of them might be beneath you and not ahead of you.

Can you escape, or are you doomed to run up an ever-lengthening staircase forever?

Write a program to simulate your escape attempt. How are you doing after ten minutes? For every second between 600 and 609 seconds inclusive print the number of steps behind you and the number still ahead of you.

If you escaped, run 10,000 tests and print the average time taken and the average final length of the staircase.