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
from microbit import *
def convert_dec_to_bin(int_number, binary_digits):
# convert a decimal number to binary stored in an array
if int_number < 0:
# it is a negative number
positive_equivalent = pow(2, binary_digits)-abs(int_number)-1
answer = bin(~positive_equivalent)
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-- Created by: Mr. Coxall
-- Created on: Jan 2018
--
-- This file animates a charact using a spritesheet
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-- Created by: Mr. Coxall
-- Created on: Jan 2018
--
-- This file animates a charact using a spritesheet
-----------------------------------------------------------------------------------------
# Mr. Coxall
# This Micro:Bit Python code goes through all the combinations of 2 44-bit positive binary numbers
from microbit import *
# variable holding the decimal value of a button
a_input = 0
a_input_as_binary = []
b_input = 0
b_input_as_binary = []
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Gravity
local physics = require( "physics" )
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Gravity
local physics = require( "physics" )
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Gravity
local physics = require( "physics" )
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Collision
local physics = require( "physics" )