Python GUI 015 – Cryptarithm Solver, part 6, Normal Parser

We’ll now get into the contents of cryptarithm_normal_parser.py. ################################# cryptarithm_normal_parser.py ################################# This file contains the following functions: is_normal_cryptarithm(line)parse_normal_cryptarithm(line, con)process_add_subtract(eqn)process_mult(eqn)process_division(eqn)process_root(line, eqn)get_base(line) There are no special classes or global variables. “””is_normal_cryptarithm() tests whether the CON is a recognized type as given in the “ops” list, and returns True if the type given in “line” appears in ops.”””Continue reading “Python GUI 015 – Cryptarithm Solver, part 6, Normal Parser”

Python GUI 014 – Cryptarithm Solver, part 5, Equation Theory

We’re finally getting to the real heart of the project – preparing normal cryptarithms (addition, subtraction, et al.) for solution. I briefly covered what the raw CONs look like in part 1. In general, a cryptarithm CON will be one or more lines, separated by a line break, that contain the superficial elements of oneContinue reading “Python GUI 014 – Cryptarithm Solver, part 5, Equation Theory”

Python GUI 013 – Cryptarithm Solver, part 4, Sudoku Solver

I’ve written at least 4 Sudoku solvers now, starting with one in action script back before Adobe bought Flash, and a couple in VBScript, then this one in Python. This means three things – first, Sudoku solvers are really easy to write. And second, that I don’t want to do it again for a longContinue reading “Python GUI 013 – Cryptarithm Solver, part 4, Sudoku Solver”

Python GUI 012 – Cryptarithm Solver, part 3, Magic Square Solver

cryptarithm_magic_square_solver.py (MMS) is a good introduction to how my cryptarithm_normal_solver.py (which is more elaborate) works. Unlike the normal solver, MMS only has one operator – addition – although there are several different kinds of magic square configurations we may be presented with (pairs of 3x3s, a 4×4 or a 5×5), and the square total couldContinue reading “Python GUI 012 – Cryptarithm Solver, part 3, Magic Square Solver”

Python GUI 011 – Cryptarithm Solver, part 2, Cryptarithm Utils

It may not look like it, if you just examine the GUI.py files, but I do like aggregating common functions from across multiple projects into single utils.py modules. This is still not provable based on the following functions in cryptarithm_utils.py. With luck, I’ll be able to redeem myself when I get to the transposition cipherContinue reading “Python GUI 011 – Cryptarithm Solver, part 2, Cryptarithm Utils”

Python GUI 010 – Cryptarithm Solver, part 1, the GUI

Cryptarithms are equations with the numbers replaced by letters, usually in a way to create amusing juxtapositions of words. Often, when the letters used for the puzzle are arranged in a specific way (such as in ascending or descending digit order), they’ll spell out a key (occasionally, the key is “no word”). The ACA recognizesContinue reading “Python GUI 010 – Cryptarithm Solver, part 1, the GUI”

Python GUI 009 – inc_utils.py

IncrementingI’m not sure how often I’ll be dedicating entire blog entries to specific utility modules, but it seems appropriate to get into this one right now. There are several ways we can attack a cryptogram from software: 1) Attack the plaintext with a hint word, or crib2) Use a dictionary to attack the keyword3) FrequencyContinue reading “Python GUI 009 – inc_utils.py”

Python GUI 008 – cons_gui_utils.py

Continuing from Python GUI 007, here we have the common functions to be used by all of the solver tools for reading and writing processed CONs data. cons_gui_utils.pyThe classes and functions in this file are: ClassConRecordsConTitleFields(Enum) process_cons_processed_file(pathname, fstr)get_filename(name)initial_parse_cons_processed(pname, fstr)save_con_file(root, filename)show_about_box(root, name)popup_msg(root, msg) Global Variables: loaded_file = Falseenum_length = len(ConTitleFields) Imports and Initialization “””Start of cons_gui_utils.pyThisContinue reading “Python GUI 008 – cons_gui_utils.py”

Python GUI 007 – cons_parser_main_functions.py

As mentioned in Python GUI 005, the GUI section, I ended up splitting the main parser functions up into two files – one for parsing the initial raw CONs digital text file, and the other for reading and writing the parsed data to and from the “_processed.txt” file. I’m starting with “main functions” first. cons_parser_main_functions.pyTheContinue reading “Python GUI 007 – cons_parser_main_functions.py”

Python GUI 006 – cons_parser_gui.py, part 2

Continued from Python GUI 005. “””select_file()Initially, the user will select and load a raw cipher file, which will need to be parsed. After the file is parsed, it will be saved to ‘filename_processed.txt’. Then, the user will select and load the _processed file for further editing, or for manually entering solved plaintext and recovered keys.”””Continue reading “Python GUI 006 – cons_parser_gui.py, part 2”

Design a site like this with WordPress.com
Get started