A Sudoku is a puzzle consisting of a three-by-three or four-by-four of spaces or numbers. The solution of a three-by-three Sudoku is to fill in the blanks with numbers 1…9 such that each three-by-three unit has only one of the numbers 1…9. Below is a worked example of a Sudoku:
4 1 7 3 6 9 8 2 5
6 3 2 1 5 8 9 4 7
9 5 8 7 2 4 3 1 6
8 2 5 4 3 7 1 6 9
7 9 1 5 8 6 4 3 2
3 4 6 9 1 2 7 5 8
2 8 9 6 4 3 5 7 1
5 7 3 2 9 1 6 8 4
1 6 4 8 7 5 2 9 3
I translated a Python program by Peter Norvig into C#. I used Norvig’s 95 “hard” to solve sudokus. It takes between thirty and fifty seconds on my home desktop to solve the 95 sudokus. Here is the tail of the run to solve the 95 sudokus. You can also solve one of the 95 sudokus by hand.
Way back in the mid-1960s there was an influential psychology book named “Games People Play” by Eric Berne, a psychiatrist, and it was based on the relatively new psychological paradigm entitled Transactional Analysis or TA for short. Transactional analysis was a replacement for Freudian analysis and human beings were represented by Parent (Super-ego), Adult (Ego), and Child (Id). The terms in parentheses are the Freudian terminology. Transactional analysis introduced the transaction which can be between Parent-Parent, Parent-Adult, Parent-Child, Adult-Child, Child-Child, Adult-Adult, and Parent-Parent. Crossed transactions such as Parent-Child, Parent-Adult, Adult-Child should probably be avoided.
Some of more popular games are “if it weren’t for you (IIWFY)” and “let you and him fight (LYAHF)”. IIWFY is a blame game. LYAHY is an ego building game for the person instigating the fight and is very popular at bars among drunks (people of diminished capacity).
The fourteen peg puzzle is a form of amusement which I have seen at my local Cracker Barrel. The puzzle involves fourteen pegs in fifteen holes in a triangular configuration. The top hole is empty. The object of the puzzle is to jump pegs over one another until only one peg is left. Jumped pegs are removed from the board.
Building the Sample
This project should build as is using Visual Studio 2008.
Description
This application was translated from a Turbo Pascal program found in Data Structure Using Turbo Pascal by Thomas M. Boger. Depth-first search with backtracking is utilized to find the solution in the allowed thirteen moves. Two stacks are used to store the moves a move stack and a reverse move stack. The translation process had to take into account a relatively strange Turbo Pascal table and an array whose base index was -1. Boger creates an array for the representation of the fourteen peg puzzle that is a right triangle for internal application operations.
These incomplete elliptic integrals are one dimensional and can be readily calculated using the Gauss-Legendre one dimensional integration technique. I use a 128 points in each integral computation. The integrals have two parameters x and k. We evaluate the F(x, k), the incomplete elliptic integral of the first kind, and E(x, k), the incomplete integral of the second kind.
Back in the 1980s a former professor of mine in mathematics at LaGrange College posed a problem to me. He handed me a deflated football and asked me to compute the volume and surface area when it was inflated. Unfortunately, I just got around to solving the problem today, Sunday, October 11, 2020. I had some help from the Casio Corporation which has a lot of free calculators on the Internet:
An anagram is also known as a word jumble. You take a word and apply a permutation to the word to get an alphabetic jumble of the word. A permutation of three distinct characters is based on three index permutation table:
123 132 213 231 312 321.
So, the scrambling of the word “THE” is as follows:
THE TEH HTE HET ETH EHT.
As you can see there are n-factorial permutations of n objects.
0! = 1
1! = 1
2! = 2 * 1 = 2
3! = 3 * 2 * 1 = 6
4! = 4 * 3 * 2 * 1 = 4 * 3! = 24
Etc. Several years ago I created a program to solve single word anagrams of length less than or equal about a dozen.
12! = 479,001,600
This is about the limit of finding all the permutations of up to length twelve on a desktop computer. The algorithm is extremely easy to understand and implement. First find a suitable list of English words and if the list is unsorted then sort the list alphabetically in ascending order. Hash the dictionary words using a hash table of length 128 * 128 + 128 = 16,512 elements. The dictionary I used has 152,512 words so there are hash table collisions. The hash value is computed using the first three characters of the word in ASCII (7-bit) encoding. Then for each permutation of the anagram a hash value is computed and if the current permutation is found in the hash table the word associated with the hash table entry is returned and the algorithm is finished.
On Sunday, August 28, 2016, 3:57:53 PM I created a C# program to fit a given curve to a polynomial of a specified degree and number of points. Here are ten experiments with a continuous function to be discretely fitted by a polynomial.