Skip to content

Instantly share code, notes, and snippets.

@richardbwest
richardbwest / bruteforceforloop.py
Created June 2, 2020 01:47
Brute force for loop version
chars = "abcdefghijklmNO123£$%"
for a in chars:
print(a)
for b in chars:
print(a+b)
for c in chars:
print(a+b+c)
for d in chars:
print(a+b+c+d)
@richardbwest
richardbwest / bruteforcerecursive.py
Created June 2, 2020 01:27
Brute Force Recursive Demo
chars = "abcABC123£$%" #Add as many chars as you like to the test (or generate using and ord to chr range)
maxlen = 4 #Maximum password length to generate.
def brute(current):
print(current)
if len(current) == maxlen:
return
for letter in chars:
@richardbwest
richardbwest / matchlists1.py
Last active September 10, 2019 14:03
matching lists code wip
a=[[9, 15, 25],[4, 14, 18, 25],[11, 12,24, 25],[4, 8, 9, 26]]
b=[[2, 4, 7, 13, 14],[3, 5, 8, 13, 14],[6, 9, 10, 13, 14],[5, 6, 7, 13, 15],[3, 4, 9, 13, 15],[2, 8, 12, 13, 15],[4, 6, 8, 14, 15],[2, 5, 9, 14, 15]]
#Basically i would like to match 2d list to another 2d list.
<iframe src="https://scratch.mit.edu/projects/PROJECTID/embed" width="800" height="600"></iframe>
<iframe src="https://scratch.mit.edu/projects/PROJECTID/embed" width="800" height="600"></iframe>
@richardbwest
richardbwest / higherorlowercardgame.py
Created February 8, 2019 23:16
Higher or Lower Card Game tutorial
import time, os, random
ranks = ["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"]
suits = ["Clubs","Hearts","Diamonds","Spades"]
deck = []
value = 1
for rank in ranks:
for suit in suits:
deck.append([rank + " of " + suit, value])
@richardbwest
richardbwest / waitinggame.py
Created August 28, 2018 11:33
Python Waiting Game Tutorial Code.
import random, time,os
while True: #infinite loop
os.system('cls') # linux - clear
print("Welcome to the waiting game!")
print("\n\n")
print("Instructions\n")
print("You will be told to wait a number of seconds.")
print("Wait that number of seconds and then press ENTER")
print("Are you ready? Press ENTER to start...")
@richardbwest
richardbwest / flappybird.py
Created August 27, 2018 15:56
Simple Flappybird style game in Minecraft coded using Python
import mcpi.minecraft as minecraft
import mcpi.block as block
import random, time
mc = minecraft.Minecraft.create()
def drawPillar(x):
@richardbwest
richardbwest / rockscissorspaper.py
Created August 23, 2018 11:18
A simple implementation of a rock, paper scissors game.
import random,time
userScore = 0
compScore = 0
choices = ["r","p","s"]
rnd = 1
while True: #Infinite Loop
@richardbwest
richardbwest / minecraftcastle.py
Created August 18, 2018 11:23
Minecraf castle code using Python.
import datetime,time,math
import mcpi.minecraft as minecraft
import mcpi.block as block
mc = minecraft.Minecraft.create()
mc.setBlocks(-100,0,-100,100,100,100,block.AIR)
def drawTower(tx,ty,tz):