Making a Code Busters test using Python
-
- Member
- Posts: 96
- Joined: October 22nd, 2017, 9:33 am
- Division: C
- State: CA
- Pronouns: She/Her/Hers
- Has thanked: 4 times
- Been thanked: 18 times
Making a Code Busters test using Python
So, I've been bored this summer and I made a Codebusters test with Python. (Contains monoalphabetic, affine, caesar shift, vingere, bacon, and rsa).
Would anyone be interested in checking my coding (I'm not exactly good at it, and while it runs ok, I think it can definetly be improved) or just telling me how I can make it better?
Thanks!
(If this is the wrong type of stuff to put in general, sorry!)
Edit: I just found out you can link to your respositories on github (i have no idea what i'm doing as you can tell) and it's here: https://github.com/erasedbird/Code-Busters.git
Would anyone be interested in checking my coding (I'm not exactly good at it, and while it runs ok, I think it can definetly be improved) or just telling me how I can make it better?
Thanks!
(If this is the wrong type of stuff to put in general, sorry!)
Edit: I just found out you can link to your respositories on github (i have no idea what i'm doing as you can tell) and it's here: https://github.com/erasedbird/Code-Busters.git
Last edited by Birdmusic on August 21st, 2018, 7:16 pm, edited 1 time in total.
I like birds.
-
- Exalted Member
- Posts: 1597
- Joined: January 18th, 2015, 7:42 am
- Division: C
- State: PA
- Has thanked: 6 times
- Been thanked: 15 times
Re: Making a Code Busters test using Python
Where's your code?Birdmusic wrote:So, I've been bored this summer and I made a Codebusters test with Python. (Contains monoalphabetic, affine, caesar shift, vingere, bacon, and rsa).
Would anyone be interested in checking my coding (I'm not exactly good at it, and while it runs ok, I think it can definetly be improved) or just telling me how I can make it better?
Thanks!
(If this is the wrong type of stuff to put in general, sorry!)
-
- Member
- Posts: 96
- Joined: October 22nd, 2017, 9:33 am
- Division: C
- State: CA
- Pronouns: She/Her/Hers
- Has thanked: 4 times
- Been thanked: 18 times
Re: Making a Code Busters test using Python
Sorry I forgot to put!UTF-8 U+6211 U+662F wrote:Where's your code?Birdmusic wrote:So, I've been bored this summer and I made a Codebusters test with Python. (Contains monoalphabetic, affine, caesar shift, vingere, bacon, and rsa).
Would anyone be interested in checking my coding (I'm not exactly good at it, and while it runs ok, I think it can definetly be improved) or just telling me how I can make it better?
Thanks!
(If this is the wrong type of stuff to put in general, sorry!)
I have a Github called Erasedbird and the repository is Code-Busters. (I think you can search it up, but I’m kinda new to github, so if it doesn’t work, I’ll make a doc with all the code)
I like birds.
-
- Member
- Posts: 1
- Joined: April 14th, 2018, 6:52 am
- Division: C
- State: KS
- Has thanked: 0
- Been thanked: 0
Re: Making a Code Busters test using Python
Funny enough, I made a similar thing but in Javascript. Your code looks like it works, but could probably be simplified by writing a few functions all the ciphers can use, some things like get_num_for_letter and get_letter_for_num. Most monoalphabetic questions I've seen provide a frequency table, so you may want to add those if you want to practice it realistically using this.
-
- Member
- Posts: 96
- Joined: October 22nd, 2017, 9:33 am
- Division: C
- State: CA
- Pronouns: She/Her/Hers
- Has thanked: 4 times
- Been thanked: 18 times
Re: Making a Code Busters test using Python
Thank you! I will try to add a frequency table, and I will try to make it more efficient with the function all cipher can use.Theta wrote:Funny enough, I made a similar thing but in Javascript. Your code looks like it works, but could probably be simplified by writing a few functions all the ciphers can use, some things like get_num_for_letter and get_letter_for_num. Most monoalphabetic questions I've seen provide a frequency table, so you may want to add those if you want to practice it realistically using this.
(I guess having more tests is something we all want! XD)
I like birds.
- l0lit
- Member
- Posts: 48
- Joined: July 30th, 2018, 12:20 pm
- Division: C
- State: FL
- Has thanked: 0
- Been thanked: 12 times
Re: Making a Code Busters test using Python
I did a similar thing, but not as advanced as I did not have that much time to improve it. 2 things I would add:Birdmusic wrote:So, I've been bored this summer and I made a Codebusters test with Python. (Contains monoalphabetic, affine, caesar shift, vingere, bacon, and rsa).
Would anyone be interested in checking my coding (I'm not exactly good at it, and while it runs ok, I think it can definetly be improved) or just telling me how I can make it better?
Thanks!
(If this is the wrong type of stuff to put in general, sorry!)
Edit: I just found out you can link to your respositories on github (i have no idea what i'm doing as you can tell) and it's here: https://github.com/erasedbird/Code-Busters.git
1. For the Baconian cipher, instead of having a giant piece of text with every Baconian letter in it, I believe that making a separate function that converts letters to numbers to binary on the spot would be more efficient. Then, for characters, you could have a list of 2-item lists. Here's an example of what I'm thinking:
Code: Select all
chars = [['A','B'],['>','<']]
alphabet = "abcdefghijklmnopqrstuvwxyz"
def letter_to_bacon(l, charlist):
l_value = alphabet.index(l.lower())
l_bin = "{0:b}".format(l_value)
bacon = ""
for char in l_bin:
bacon += charlist[int(char)]
# to turn into 5 letter output
for x in range(len(bacon),5):
bacon = "A" + bacon
return bacon
# Example converting letter B using set ['A','B']
print(letter_to_bacon("b",chars[0]))
# returns "AAAAB" - correct
2. Instead of using your plaintext.py, I think downloading the Python quotes module here. This would prevent repetition and prediction. You can even add in your own quotes!
3. My program also had a basic function to instead write the test into a .txt file, and the key into another file, for easy taking and printing. This way, the test won't disappear if you press enter, and it is best to practice on paper. If you want to make it more complex, you can write it into XML files for Word.
Any opinions stated on this site are not official, the only official information can be found at soinc.org
University of South Florida '25
Carmel SciOly Alumni, Captain 2019-21
Tests written
University of South Florida '25
Carmel SciOly Alumni, Captain 2019-21
Tests written
-
- Member
- Posts: 96
- Joined: October 22nd, 2017, 9:33 am
- Division: C
- State: CA
- Pronouns: She/Her/Hers
- Has thanked: 4 times
- Been thanked: 18 times
Re: Making a Code Busters test using Python
Thank you for the great advice! I will try those out!l0lit wrote:I did a similar thing, but not as advanced as I did not have that much time to improve it. 2 things I would add:Birdmusic wrote:So, I've been bored this summer and I made a Codebusters test with Python. (Contains monoalphabetic, affine, caesar shift, vingere, bacon, and rsa).
Would anyone be interested in checking my coding (I'm not exactly good at it, and while it runs ok, I think it can definetly be improved) or just telling me how I can make it better?
Thanks!
(If this is the wrong type of stuff to put in general, sorry!)
Edit: I just found out you can link to your respositories on github (i have no idea what i'm doing as you can tell) and it's here: https://github.com/erasedbird/Code-Busters.git
1. For the Baconian cipher, instead of having a giant piece of text with every Baconian letter in it, I believe that making a separate function that converts letters to numbers to binary on the spot would be more efficient. Then, for characters, you could have a list of 2-item lists. Here's an example of what I'm thinking:You can just as easily input chars[1] to change the type. This would give more versatility with binary and get competitors used to seeing Baconian that may not necessarily be "A" and "B" (like some tests I experienced last year).Code: Select all
chars = [['A','B'],['>','<']] alphabet = "abcdefghijklmnopqrstuvwxyz" def letter_to_bacon(l, charlist): l_value = alphabet.index(l.lower()) l_bin = "{0:b}".format(l_value) bacon = "" for char in l_bin: bacon += charlist[int(char)] # to turn into 5 letter output for x in range(len(bacon),5): bacon = "A" + bacon return bacon # Example converting letter B using set ['A','B'] print(letter_to_bacon("b",chars[0])) # returns "AAAAB" - correct
2. Instead of using your plaintext.py, I think downloading the Python quotes module here. This would prevent repetition and prediction. You can even add in your own quotes!
3. My program also had a basic function to instead write the test into a .txt file, and the key into another file, for easy taking and printing. This way, the test won't disappear if you press enter, and it is best to practice on paper. If you want to make it more complex, you can write it into XML files for Word.
I like birds.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest