Skip to content

Instantly share code, notes, and snippets.

View LizardLeliel's full-sized avatar

Evan Larose LizardLeliel

  • Halifax, Canada
View GitHub Profile
@LizardLeliel
LizardLeliel / D.py
Last active August 29, 2015 13:59
Dalhousie Problem Letter D.
#This is from Dalhousie Univerisity's programming competition, problem letter D.
#It was the easist. There were 7 lines of input. I was suposed to print the average of the highest 6 values,
#with the output formatted to four decimal places.
#Due to its brevity, I haven't code commented it.
a = []
for each in range(7):
@LizardLeliel
LizardLeliel / B.py
Last active August 29, 2015 13:59
Dalhousie problem letter B.
#This was Dalhousie Programming Competition 2014 programming problem letter B.
#I found that the 2d lists (Python doesn't have 2d arrays; they have things called lists, similar to arrays, but only one dimensional...
#you had to have lists in lists to have dimensionality) I've used while programming an older Sudoku program of mine to be helpful
#This Problem had a varying ammount of inputs. The first input was how many inputs was going to follow,
#While all lines after that were in the format "name ##". The ## was a number between 1 and 100, an represents
#The mark of each name. The names were useless, but I was suposed to make a histogram based on how many people
#Got Something in the tens digit. In other words...
@LizardLeliel
LizardLeliel / E.py
Last active August 29, 2015 13:59
Dalhousie problem letter E
#This was Dalhousie University's 2014 programming competition problem letter E.
#We were suposed to have input as a text file, which were suposed to be mock examples of twitter posts. We had to output any
#line that contained a line that contained an expression like "3-4".
#This was meant to be done with Regular Expressions, but I have had no knowledge in those, so I had to do something unique and creative.
#I also did something I have never done before in programming - error trapping. Although very basic one and probably not the
#intended use for them, I have used them to solve my problem, with only having read what the try and except keywords did.
#My solution to go through every letter of every line, put each letter to a new string if it wasn't a number, and if it was a number,
@LizardLeliel
LizardLeliel / A.py
Last active August 29, 2015 13:59
Dalhousie problem letter A
#This was problem A of the Dalhousie programming competiton. Of the four of five submissions I made, this was the only one that
#didn't suceed, and is also the most messiest and hardest to follow, but felt this showed some creative thinking
#The problem was that I had to figure out who won, based on how many problems the person solved, and if there's a tie, who did it in the shortest
#combined time of the problems.
#I would of had one line of input Which would be four numbers, representing the number of people in the competition,
#The number of problems there's going to be, what hour the competition started, and what minute the competition started.
#The second line is how many attempts to a problem there was from each person total
@LizardLeliel
LizardLeliel / RubixCube.py
Last active August 29, 2015 14:00
Rubix's Cube classes
import random
#Before the Saint Mary's competition, I've written two classes to use for creating a Rubix cube, to practice
#Objects in object-oriented languages.
#This was the basis of which I derived my Visual Basic Rubix Classes Module.
class Face:
def __init__(self, colour):
self.colour = colour
@LizardLeliel
LizardLeliel / RubixClasses.vb
Last active August 29, 2015 14:01
A module of the two classes that were used for building the rubix cube program for the Saint Mary University's 2014 hackathon competition.
'The two classes here were used in "The Interactive Rubix Cube", created by Evan Larose and Tristan Murphy,
'for the SMU 2014 hackathon
'All code comments below were included in the actual module
Module RubixClasses
'The sides represent each face of the Rubix Cube. They're used in the cube class before.
'They have a string variable to represent what colour they are, as well as
'a 3x3 array of string that represent each square on the side
@LizardLeliel
LizardLeliel / RubixSolver.vb
Last active August 29, 2015 14:01
A few sub procedures in Visual Basic using Visual Studio meant to solve a Rubix cube (where the Rubix cube is an instance of a cube class from the rubix cube module from another gist here. Cube is named "dub" in this program, for that was the easist to type)
'This sub procedure (which is linked to a wpf button in Visual Studio) solves a rubix cube by using
'Algorithms that prodecurally solve it.
'I put a lot of hours in it; taking most of my week evenings to code it, and taking time during class to write down pseudocode.
'However, I still manage to complete the entire code in just a week. However, despite it working as supsected (once
'I've got the final revision on it, I have not had it lock up once on proper cubes), there's still many things
'about the code that could be improved. I feel most of it's unfineness was a result in a pressure to finish it. However, some
'of the problems include:
'-The entire thing is nested in one big while statement. Although I originally had intentions for having it in
@LizardLeliel
LizardLeliel / (a) RomanNumeralConversion.cpp
Last active August 29, 2015 14:07
This program takes a roman numeral string as a command-line parameter, and outputs its value as an integer. It does not check for the validity of the roman numeral, but it does not crash (non-roman numerals are treated as zeros; values less then the highest value to values on their right are treated as subtracted values (which is correct for iv,…
#include <stack>
#include <string>
#include <iostream>
#include "RomanConversionTools.hpp"
using namespace std;
int main (int argv, char* argc[]) {
// Examine arg count and exit if there's an incorrect parameter ammount
if (argv != 2) {
cout << "Wrong ammount of parameters" << endl;
@LizardLeliel
LizardLeliel / Quine.cpp
Created October 14, 2014 17:48
A program that outputs its source code. The logic in this file is my own design; I didn't strictly follow code conventions for this exercise, hence the function named function.
#include <iostream>
#include <string>
using namespace std;
void function(string var, int flag);
int main(){
function(R"!(
#include <iostream>
@LizardLeliel
LizardLeliel / LinkedList.cpp
Created October 28, 2014 22:43
Linked List demonstration
#include <iostream>
using namespace std;
int main()
{
// Node Structure
struct Node {
int data;
Node *next;