Skip to content

Instantly share code, notes, and snippets.

View Mr-Coxall's full-sized avatar

Patrick Coxall Mr-Coxall

  • St. Mother Teresa HS
  • Ottawa
View GitHub Profile
@Mr-Coxall
Mr-Coxall / game.py
Created November 3, 2022 16:16 — forked from Per48edjes/game.py
Python OOP implementation of Conway's Game of Life
import os
from itertools import product
from random import randint
from time import sleep
class Cell:
def __init__(self, state):
self._state = state
self._future_state = state
@Mr-Coxall
Mr-Coxall / blockpy_dict_blocks
Created March 6, 2020 16:15 — forked from acbart/blockpy_dict_blocks
dict_get and dict_create_with blocks for blockpy
// The raw blocks
Blockly.Msg.TYPE_CHECK = "check type of"
Blockly.Msg.DICT_KEYS = "get all keys of "
Blockly.Msg.DICT_GET = "get value of key"
Blockly.Msg.DICT_GET_TO = "from"
Blockly.Msg.DICTS_CREATE_WITH_INPUT_WITH = "dict of"
Blockly.Msg.DICTS_CREATE_WITH_TOOLTIP = "Create a new dictionary"
Blockly.Msg.DICTS_CREATE_EMPTY_TITLE = "Create empty dict"
Blockly.Msg.DICTS_CREATE_WITH_CONTAINER_TITLE_ADD = "key-value pairs"
@Mr-Coxall
Mr-Coxall / global_variables.py
Last active July 1, 2018 02:52
global_variables.py
# Created by: Mr. Coxall
# Created on: Sep 2018
# Created for: ICS3U
# This program shows the difference between local and global variables
import ui
variableX = 25
def local_button_touch_up_inside(sender):
@Mr-Coxall
Mr-Coxall / pizza.py
Last active July 1, 2018 02:50
pizza.py
# Created by: Mr. Coxall
# Created on: Sep 2018
# Created for: ICS3U
# This program calculates the cost of a pizza, give the diameter
import ui
def calculate_button_touch_up_inside(sender):
# calculate circumference
@Mr-Coxall
Mr-Coxall / circumference.py
Last active July 1, 2018 02:49
circumference.py
# Created by: Mr. Coxall
# Created on: Sep 2018
# Created for: ICS3U
# This program calculates the circumference of a circle,
# when you give it the radius
import ui
def calculate_touch_up_inside(sender):
# calculate circumference
@Mr-Coxall
Mr-Coxall / area_and_perimeter_ver2.py
Last active July 1, 2018 02:45
area_and_perimeter_ver2.py
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program displays area and perimeter of a rectangle,
# but this time the user can enter different lengths and widths
import ui
def calculate_button_touch_up_inside(sender):
# calculate area and perimeter
@Mr-Coxall
Mr-Coxall / images.py
Last active July 1, 2018 02:44
images.pyui
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program shows images
import ui
# first get a reference to the image you saved in your Python folder
my_pic = ui.Image.named('./sprites/MT_crest.jpg')
@Mr-Coxall
Mr-Coxall / mascot.py
Last active July 1, 2018 02:42
mascot.pdf
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program displays the school name and their mascot
import ui
def mother_teresa_touch_up_inside(sender):
# displays the school and mascot for MT
view['school_name_label'].text = 'Mother Teresa HS'
@Mr-Coxall
Mr-Coxall / area_and_perimeter.py
Last active July 1, 2018 02:32
area_and_perimeter.py
# Created by: Mr. Coxall
# Created on: Sep 2018
# Created for: ICS3U
# This program calculates the area and perimter of a rectangle
import ui
def answer_touch_up_inside(sender):
# displays the answer for area and perimeter
view['area_answer_label'].text = 'Area = ' + str(3*5) + ' cm^2'
@Mr-Coxall
Mr-Coxall / calculations.py
Last active July 1, 2018 02:31
calculations.py
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program does basic math
import ui
def equation1_touch_up_inside(sender):
# displays the answer to equation 1