FORTRAN90 Programs Useful for Puzzles

PUZZLES is a directory of FORTRAN90 programs which were used to solve puzzles.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


PUZZLES is available in a FORTRAN90 version and a MATLAB version.

Related Programs:

ANAGRAM, a C++ program which determines anagrams of a string, by James Cherry;

LADDERS, a C program which seeks to transform one five letter word into another, by changing one letter at a time, using only legitimate English words. This puzzle was invented by Lewis Carroll, who called it "Doublets", but it is also known as "Word Ladders" or "Word Gold". The program is by Donald Knuth.

LIFE_OPENGL, a C program which uses OpenGL to display the evolution of John Conway's "Game of Life", by Simon Green.

LIGHTS_OUT_OPENGL, a C++ program which sets up a "Lights Out" game and allows the user to solve it, using the OpenGL graphics window.

SUBANAGRAM, a FORTRAN90 program which finds words which are anagrams formed from some of the letters of a given master word.

SUDOKU, a MATLAB library which manipulates and solves Sudoku problems.

WORDSNAKE, a FORTRAN90 program which rearranges a list of words so that they have maximum overlap;

Source Code


The ascendogram puzzle is posed in The Ascendogram Puzzle. To answer the question, a program was written, which searched a text file.


Textropolis is an iPhone application which presents you with the name of a city and asks for as many words as you can form, using only the letters in the city name. It also wants the words to be at least 4 letters long. Vivian is desperate to get all 130 words that that game claims you can make. She's hoping to see fireworks over the Amsterdam cityscape!


The football score puzzle is posed in The Football Puzzle. To answer the question, a program was written.


The following challenge appeared in an advertistement in the New York Times, 14 June 2007:

"Dear Ketel One Drinker: Can you make one hundred words, of four letters or more, from the letters in Ketel One Vodka?"
To answer the question, a program was written, which searched a text file.


The "lock" puzzle is posed in The Lock Puzzle. My nephew Logan called to say he was stuck on a puzzle in a video game. He was facing a lock which had four dials, and he needed to change the current combination to a specified one. The trick was that the dials affected their neighbors. Turning dial 1 would turn dial 2 the same amount. Turning dial 2 or dial 3 also turned the immediate left and right neighbors, while dial 4 also made dial 3 turn. This complication made it difficult to see how to go from a combination of, say, 1492, to a target of 1234.


The "thirty one" puzzle is posed in The Thirty One Puzzle. A tableau of 24 cards is laid out, consisting of 4 copies of each number from 1 to 6. Two players alternate in selecting a card from the tableau. As a card is chosen by either player, its face value is added to the total. If a player's choice causes the total to reach exactly 31, that player wins. If a player's choice increases the total past 31, the game is a draw. The program given here allows the user to play the first player, which the program plays the second player. The program analyzes its next move to see if it has a win, or if its move would allow the user to win immediately. The program was written by Yuen-Yick Kwan.


The unigram puzzle is posed in The Unigram Puzzle. To answer the question, a program was written, which searched a text file.


The zero-one puzzle is posed in The Zero One Puzzle. To test the proposed solutions, a program was written.

You can go up one level to the FORTRAN90 source codes.

Last revised on 08 May 2011.