Skip to content

doctorray117/ev2020games

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ev2020games

Anagram comparison from two word lists, based on the game directive at https://www.electoral-vote.com/evp2020/Pres/Maps/Nov03.html#item-7

What does it do

This code takes a word or phrase in the first list (source) to see if any number of characters could be rearranged to create a word in the second list (dictionary). Think of it as a simple anagram solver where the source word is a pool of letters used to create a matching word in the corresponding dictionary. Words are scored by length using Zenger's modified fibonacci sequence and printed alongside the results.

How it works

To determine if a letters from a word in the source can be found in the dictionary, mark off the first letter in the dictionary word that appears when testing each of the letters in the source word. If you've marked off all the letters in the dictionary word, you have a match.

This python script does exactly that.

The code isn't written to be super pretty, probably imports stuff it doesn't need, etc.

Inputs

Create a sourcefile and a dictionaryfile that contain all the words or phrases to compare. The program will remove any special characters, though you may consider replacing any non-English letters to their English equivalents as those would otherwise be removed. Everything on the line will be considered, so if downloading CSV's please strip out the unnecessary columns in excel/whatever first.

Usage

./findevmatches.py -s source/quiz01/legislatures-current.txt -d source/quiz01/oscars.txt

All of the existing sources are run in the "runquiz.sh" file

sources gathered so far:

  1. Current member of Congress → Academy Award-winning film
  1. Political slogan used by any U.S. candidate → Periodic table element
  1. Democratic nominee for president (winner or loser) → Beatles song title
  1. Republican nominee for president (winner or loser) → Religious figure (living or dead, any religion)
  1. President who died in office → Disease
  1. U.S. political party (any, and including the word 'party') → "Star Wars" planet, character, or race
  1. Politician who played college sports → Professional sports team (city and mascot, or just mascot)
  1. Person who served as Secretary of the Treasury → World currency (current or past)
  1. Any living politician → Palindrome
  1. Any dead politician → Shakespeare character

About

Anagram comparison from two word lists

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published