{{ message }}

Instantly share code, notes, and snippets.

# KirkWanooknox

Last active Aug 29, 2015
Pawned!

#PAWNED!

######CMPT317 - KIRK MCCULLOCH – 11146754 ######MARCH 4, 2015

##PROBLEM DESCRIPTION Pawned is a simple game based on chess, which is played on a 5 by 6 board. Each player has five pawns (black or white) placed along either the top or bottom rows. Similar to how a pawn moves in chess, in Pawned a pawn can only move forwards, or attack on the left and right diagonals. Additionally, pawns in Pawned cannot move two spaces on their first move, they are restricted to single space moves. The goal of the game is to get one of your pawns to the opponent's side of the board.

In any given turn, players are required to make a move if a valid move is available. If a player cannot move any of their pawns (e.g. all pawns are stuck with an opponent's pawn in the square directly in front), then the player must pass and the turn changes to the opponent. The game ends when one player reaches the opposite side or all pawns on the board are unable to move, in which case the player with the most pawns wins.

Created Apr 23, 2015
A FizzBuzz paradise. More variants to come.
View fizzbuzz.js
 for (i = 0; i < 100; i++) { var test = ""; if (i % 3 == 0) //multiple of 3 { test += "fizz"; } if (i % 5 == 0) //multiple of 5 { test += "buzz"; } if (test == "") //no multiple { test = i; } document.write(test + "
"); //print
Created Mar 12, 2013
Recursive matrix determinants by cofactor expansion. Contains Minor, Cofactor, CofactorMatrix, Transpose, Adjoint, and Inverse methods. The corresponding IMatrix, AMatrix, and full Matrix class structure is not mine to post. Structure assumes matrix indexing is 1 based, not 0 based.
View Matrix.cs
 public double Minor(int row, int col) { //can only calculate a Minor value if the matrix is square if (this.Rows != this.Cols) { throw new ApplicationException("Number of rows does not match number of columns"); } //the sub matrix Matrix subMatrix = (Matrix)this.NewMatrix(this.Rows - 1, this.Cols - 1);
Created Oct 24, 2017