Ballistics Calculator Tests from an Internet Webpage by James Pate Williams, Jr., BA, BS, MSwE, PhD

We try to match-up my theoretical calculations against the numbers on the following webpage:

https://pmcammo.com/product/bronze-223a-mb/

First we input data into the calculator:

If I were an ammo mogul I would probably have extensive field testing of each new set of bronze cartridges created. Bronze (copper and tin) is better than brass (copper and zinc) because of the following criteria: it is harder and more corrosion resistant than brass. These tests would include ballistics Doppler radar test firings. Note that this bronze probably comes from Republic of Korea and the .223 Remington cartridges are a product of the Republic of Korea.

SHA-3 Secure Hashing Function by James Pate Williams, Jr., BA, BS, MSwE, PhD

Back in February 2015 I implemented the SHA-3 Secure Hashing Function which is a National Institutes of Standards and Technology Standard. This is much less verbose than my 2018 blog post about SHA-3.

https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values

Below are the testing outputs for inputs of 0, 5, and 30 bits.

Machine Solution of “Hard” Sudokus by James Pate Williams, Jr., BA, BS, MSwE, PhD

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.

Games People Play by James Pate Williams, Jr., BA, BS, MSwE, PhD

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.

http://www.ericberne.com/games-people-play/

http://www.ericberne.com/dr-berne-plays-the-celebrity-game/

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).

Series Approximations for the Incomplete Elliptic Integrals of the First and Second Kind by James Pate Williams, Jr., BA, BS, MSwE, PhD

Expansion as truncated infinite power series and term-by-term integration of the integrals is illustrated in the following pictures.

Fourteen Peg Puzzle by James Pate Williams, Jr., BA, BS, MSwE, PhD

I created this project five years ago.

Technologies

C#, Visual Studio 2008, Windows Forms, Visual C#

Topics

C#, Puzzles, 14 Peg Puzzle

Platforms

Desktop

Requirements

Primary language

en-US

Updated

10/16/2015

License

MIT

View this sample online

Introduction

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.

C#

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace FourteenPegPuzzle

{

    class PegPuzzle

    {

        private const int OverRow = 0;

        private const int OverCol = 1;

        private const int ToRow = 2;

        private const int ToCol = 3;

        private const int Addend = 0;

        private int[,] moveTable =

        {{1, 0, 2, 0}, {-1, 0, -2, 0},

            {0, 1, 0, 2}, {0, -1, 0, -2},

            {1, 1, 2, 2}, {-1, -1, -2, -2}};

        private char[,] board;

        public struct StatusRec

        {

            public int pegRow, pegCol, moveNumber;

        }

        private Stack<StatusRec> moveStack;

        private Stack<StatusRec> reverseStack;

        private bool blocked;

        private int moveCount, totalMovePush;

        private StatusRec currentMove, newMove;

        private TextBox tb;

        public PegPuzzle(TextBox tb)

        {

            this.tb = tb;

            totalMovePush = 0;

            board = new char[9, 9];

        }

        private void AdvancePeg()

        {

            currentMove.pegCol++;

            if (currentMove.pegCol > currentMove.pegRow)

            {

                currentMove.pegCol = 2;

                currentMove.pegRow++;

            }

        }

        private void AdvanceMove()

        {

            currentMove.moveNumber++;

            if (currentMove.moveNumber > 5)

            {

                currentMove.moveNumber = 0;

                AdvancePeg();

            }

        }

        private void InitializeBoard()

        {

            for (int row = 0; row < 9; row++)

                for (int col = 0; col < 9; col++)

                    board[row, col] = ‘ ‘;

            for (int row = 3; row <= 6; row++)

                for (int col = 2; col <= row; col++)

                    board[row, col] = ‘X’;

            board[2, 2] = ‘O’;

        }

        private bool LegalMove()

        {

            int overRow = moveTable[currentMove.moveNumber, OverRow] + Addend;

            int overCol = moveTable[currentMove.moveNumber, OverCol] + Addend;

            int toRow = moveTable[currentMove.moveNumber, ToRow] + Addend;

            int toCol = moveTable[currentMove.moveNumber, ToCol] + Addend;

            return board[currentMove.pegRow + overRow, currentMove.pegCol + overCol] == ‘X’ &&

                board[currentMove.pegRow + toRow, currentMove.pegCol + toCol] == ‘O’;

        }

        private void PrintBoard()

        {

            for (int row = 2; row <= 6; row++)

            {

                for (int i = 1; i <= 6 – row; i++)

                    tb.Text += ‘ ‘;

                for (int col = 2; col <= row; col++)

                    tb.Text += board[row, col] + ” “;

                tb.Text += “\r\n”;

            }

            tb.Text += “\r\n”;

        }

        public void Solve()

        {

            moveStack = new Stack<StatusRec>();

            InitializeBoard();

            blocked = false;

            moveCount = 0;

            currentMove.pegRow = 2;

            currentMove.pegCol = 2;

            currentMove.moveNumber = 0;

            while (moveCount < 13 && !blocked)

            {

                if (board[currentMove.pegRow, currentMove.pegCol] != ‘X’)

                    AdvancePeg();

                else if (!LegalMove())

                    AdvanceMove();

                else

                {

                    newMove = new StatusRec();

                    newMove.moveNumber = currentMove.moveNumber;

                    newMove.pegCol = currentMove.pegCol;

                    newMove.pegRow = currentMove.pegRow;

                    moveStack.Push(newMove);

                    moveCount++;

                    totalMovePush++;

                    board[currentMove.pegRow, currentMove.pegCol] = ‘O’;

                    int overRow = moveTable[currentMove.moveNumber, OverRow] + Addend;

                    int overCol = moveTable[currentMove.moveNumber, OverCol] + Addend;

                    int toRow = moveTable[currentMove.moveNumber, ToRow] + Addend;

                    int toCol = moveTable[currentMove.moveNumber, ToCol] + Addend;

                    board[currentMove.pegRow + overRow, currentMove.pegCol + overCol] = ‘O’;

                    board[currentMove.pegRow + toRow, currentMove.pegCol + toCol] = ‘X’;

                    currentMove.pegRow = 2;

                    currentMove.pegCol = 2;

                    currentMove.moveNumber = 0;

                }

                while (currentMove.pegRow > 6 && !blocked)

                {

                    if (moveStack.Count == 0)

                        blocked = true;

                    else

                    {

                        currentMove = moveStack.Pop();

                        board[currentMove.pegRow, currentMove.pegCol] = ‘X’;

                        int overRow = moveTable[currentMove.moveNumber, OverRow] + Addend;

                        int overCol = moveTable[currentMove.moveNumber, OverCol] + Addend;

                        int toRow = moveTable[currentMove.moveNumber, ToRow] + Addend;

                        int toCol = moveTable[currentMove.moveNumber, ToCol] + Addend;

                        board[currentMove.pegRow + overRow, currentMove.pegCol + overCol] = ‘X’;

                        board[currentMove.pegRow + toRow, currentMove.pegCol + toCol] = ‘O’;

                        moveCount–;

                        AdvanceMove();

                    }

                }

            }

            if (!blocked)

            {

                InitializeBoard();

                reverseStack = new Stack<StatusRec>();

                while (moveStack.Count != 0)

                {

                    currentMove = moveStack.Pop();

                    newMove = new StatusRec();

                    newMove.moveNumber = currentMove.moveNumber;

                    newMove.pegCol = currentMove.pegCol;

                    newMove.pegRow = currentMove.pegRow;

                    reverseStack.Push(newMove);

                }

                PrintBoard();

                while (reverseStack.Count != 0)

                {

                    currentMove = reverseStack.Pop();

                    board[currentMove.pegRow, currentMove.pegCol] = ‘O’;

                    int overRow = moveTable[currentMove.moveNumber, OverRow] + Addend;

                    int overCol = moveTable[currentMove.moveNumber, OverCol] + Addend;

                    int toRow = moveTable[currentMove.moveNumber, ToRow] + Addend;

                    int toCol = moveTable[currentMove.moveNumber, ToCol] + Addend;

                    board[currentMove.pegRow + overRow, currentMove.pegCol + overCol] = ‘O’;

                    board[currentMove.pegRow + toRow, currentMove.pegCol + toCol] = ‘X’;

                    PrintBoard();

                }

            }

        }

    }

}

A Table of Values of the Incomplete Elliptic Integrals of the First and Second Kind by James Pate Williams, Jr., BA, BS, MSwE, PhD

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.

Volume and Surface Area of an Ellipsoid by James Pate Williams, Jr., BA, BS, MSwE, PhD

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:

https://keisan.casio.com/

I used one of their calculators to independently verify my own calculator.