Skip to content

Instantly share code, notes, and snippets.

View Spebby's full-sized avatar
😖

Thom Spebby

😖
  • SmileDev
  • 15:17 (UTC -07:00)
View GitHub Profile
@Spebby
Spebby / NaturaliseShift.py
Created February 11, 2024 01:07
shifts a given number by a pseudo-random value to make it feel less arbitrary.
import random
import argparse
import sys
def naturaliseShift(num):
magnitude = int(num / 15)
shift = random.randint(-magnitude, magnitude)
return num + shift
def bulk_mode():
nums = []
@Spebby
Spebby / connect_four.py
Created December 4, 2022 23:14
Simulates a game of connect four in the terminal.
#!/usr/bin/env python3
"""
Module connect_four contains the ConnectFour class, instances of which model Connect 4 games.
(Seven columns, six rows.)
"""
class ConnectFour:
"""
Models a game of Connect Four. Players can be given colors, but are still represented as 1 and 2
@Spebby
Spebby / wordclassification.py
Last active November 23, 2022 21:43
Analyses words based on their syllables and their length.
#!/usr/bin/env python3
"""
Analyses words based on their syllables and their length.
"""
import sys
import re
import math
syllCounts, syllTable = {}, {}
@Spebby
Spebby / pWeights.py
Last active November 21, 2022 19:41
protein weight calculator
#!/usr/bin/env python3
"""
Uses three sources of input and produces two forms of output regarding proteins and
their expected molecular weights for the purpose of mass spectrometry.
"""
import sys
try:
@Spebby
Spebby / weatheranalfor.py
Last active November 21, 2022 19:41
Weather Analysis
#!/usr/bin/env python3
"""
Analyses weather data from a file Santa Cruz Beach Boardwalk's weather station.
Data is collected once every 5 minutes.
assumed:
- Atleast 1 data point
- Data is formated
"""
@Spebby
Spebby / weatheranalwhile.py
Last active November 21, 2022 19:41
Weather Analysis
#!/usr/bin/env python3
"""
Analyses weather data from a file Santa Cruz Beach Boardwalk's weather station.
Data is collected once every 5 minutes.
This assignment required the exclusive use of While Loops
assumed:
- Atleast 1 data point
- Data is formated
"""
@Spebby
Spebby / MonopolySim.py
Last active November 21, 2022 19:41
rolls until jailed.
#!/usr/bin/env python3
"""Rolls dice and gives the output."""
import random
warnings = 0
LineNumber = 1
# die consts
dieCode = "⚀⚁⚂⚃⚄⚅"
@Spebby
Spebby / PaperIsFourCoins.py
Last active November 21, 2022 19:41
dolla maker
#!/usr/bin/env python3
"""currency project"""
billNames = {
0: "hundred",
1: "fifty",
2: "twenty",
3: "ten",
4: "five",
5: "one",
@Spebby
Spebby / rosalind_gc.py
Created September 23, 2022 20:07
GC analyzer
#!/usr/bin/env python3
"""takes in a DNA string and outputs GC content."""
class RosalindAnalyzer:
# takes in a string, returns a decimal representing the GC content of the string to 3 decimal places.
@staticmethod
def Analyzer(inStr: str):
GCString = "";
for char in inStr:
@Spebby
Spebby / nevadaDL.py
Created September 23, 2022 20:07
Takes in a pre-1988 Nevada DL and spits out the Birthdate and SSN used to create it.
#!/usr/bin/env python3
"""Takes in a pre-1988 Nevada DL and spits out the Birthdate and SSN used to create it."""
from datetime import date
todays_date = date.today()
fName = input().lower().title()
midName = input().lower().title()
lName = input().lower().title()