Skip to content

Instantly share code, notes, and snippets.

View XChrisUnknownX's full-sized avatar

XChrisUnknownX

View GitHub Profile
@XChrisUnknownX
XChrisUnknownX / MovingO.py
Last active December 31, 2018 19:53
presents a board with 9 spaces and allows you to move up, down, left, right. Still teaching myself python.
a1 = "-"
a2 = "-"
a3 = "-"
b1 = "-"
b2 = "-"
b3 = "-"
c1 = "-"
c2 = "-"
c3 = "-"
up = "up"
@XChrisUnknownX
XChrisUnknownX / GearsPopulationCounter.py
Created December 18, 2018 00:19
A Gears of War 4 Metagame for Python. Sets a random population at start or allows you input your own populations, then chooses random losses on each side per battle, with the winner more likely to take less losses. Has different classes of severity for each battle, impacting how many millions of humans or monsters die in any given battle. Also r…
import random
import time
humanpop = random.randint(1000000000,50000000000)
monsterpop = random.randint(1000000000,50000000000)
continue3 = input("If continuing game, type yes, no spaces or punctuation, lower case. ")
if continue3 == "yes":
continue1 = input("If continuing game, input humanpop. ")
continue2 = input("If continuing game, input monsterpop. ")
try:
humanpop = int(continue1)
@XChrisUnknownX
XChrisUnknownX / FibonacciGeneratorSAMPLE
Created October 18, 2018 19:45
This will generate Fibonacci numbers. DO NOT RUN THE PROGRAM WITHOUT MONITORING. Creates increasingly larger text files. Safely tested and opened at 10,000 fibonacci numbers ( about 10,000 KB)
import time
item1 = 0
item2 = 1
import time
fib = [0,1]
counter = 2
fibfile = open("Fibonacci Sequence.txt","w")
fibfile.write(str(1))
fibfile.write("""
""")
@XChrisUnknownX
XChrisUnknownX / Text Game Starter Pack.py
Last active April 9, 2020 03:45
This is a sample of a text game "starter pack" I am creating. I needed somewhere to store it where I could access it easily. This particular build contains a choices function for a multiple choice game and a random character creator
import random
import time
# going to create a starter pack for text games in Python.
# TABLE OF CONTENTS:
# Contains:
# choices(a): # Choices is going to accept a, an integer, how many choices you're giving the player.
# Returns integer of the choice, 1 to a.
# choicestest(): Tests choices(a).
#
# createcharacter(): creates a list that has traits of a random character, and can be used to create a proper reference to the character.
@XChrisUnknownX
XChrisUnknownX / Alphabetical Sorter
Last active October 17, 2018 15:47
Sorts txts that are in the format of chammy.txt or chammy2.txt
#If the program works correctly you should be able to give it a txt with a word on each line and it should give you a new txt with the words sorted alphabetically.
filename = input("Specify txt you wish to sort: ")
with open(filename,"r") as sortfile, open("Sorted File.txt","x") as newfile:
newstring = sortfile.read()
newlist = newstring.split()
newlist.sort()
for n in newlist:
newfile.write(n)
newfile.write("""
""")
#If the program works correctly you should be able to give it a txt with a word on each line and it should give you a new txt with the words sorted alphabetically.
#It should also theoretically give a list of all the words at the end.
#Use chammy.txt to test.
filename = input("Specify txt you wish to sort: ")
with open(filename,"r") as sortfile, open("Sorted File.txt","x") as newfile:
newlist = []
for line in sortfile:
item = sortfile.readline()
newlist.append(item)
newlist.sort()
@XChrisUnknownX
XChrisUnknownX / FileMarkerPROv1.py
Last active July 6, 2019 11:24
This program marks .txt transcripts for timed dictation/reading/practice. Must have Python 3 to use. Must keep in the same folder as the .txt you wish to mark.
import time
import sys
import random
version = "1"
print("Note: Timings are not exact. Transcript is marked at the 15 second reading interval.")
textname = input("Name of text file you wish to open. ")
wordspermin = input("Mark X words per minute. Input X. ")
@XChrisUnknownX
XChrisUnknownX / FileMarkerPROSample.py
Last active October 10, 2018 14:28
With the help of redditor Kyber I started to understand more about text management in Python. (See third attempt)
import time
import sys
import random
timeofday = random.choice(["morning","afternoon","evening"])
#time of day and the whole beginning of this program means nothing. It is an insert for if I share this program with stenographer educators so that they're not completely lost, and would be rewritten in the event I get this program to work properly.
print("Good " + timeofday + ". I am Blade. I am programmed to insert timings into ASCII files and have no clue what time of day it is.")
textname = input("Name of text file you wish to open. ")
#textname is important. User must specify the exact name of the file. In this build, the .txt must be in the same folder as the .py program.
wordspermin = input("Mark X words per minute. ")
@XChrisUnknownX
XChrisUnknownX / Rock Paper Cheater.py
Last active September 28, 2018 14:43
Rock Paper Cheater.py
import time
import random
#This is almost exactly the same code as Ultimate Rock Paper Scissor but it cheats so that the player can never win.
game1 = "game1"
game2 = "game2"
game3 = "game3"
game4 = "game4"
game5 = "game5"
game6 = "game6"
game7 = "game7"
@XChrisUnknownX
XChrisUnknownX / Ultimate Rock Paper Scissor.py
Created September 28, 2018 03:03
Ultimate Rock Paper Scissor.py
import random
import time
game1 = "game1"
game2 = "game2"
game3 = "game3"
game4 = "game4"
game5 = "game5"
game6 = "game6"
game7 = "game7"
game8 = "game8"