Skip to content

Instantly share code, notes, and snippets.

View homelinen's full-sized avatar

Calum Gilchrist homelinen

View GitHub Profile
@homelinen
homelinen / FormWords.java
Created September 13, 2011 15:25
Displays every permutation of the given letters. Probably a horrible way of doing it.
import java.util.*;
class FormWords {
private String joinLetters(ArrayList<String> letters) {
String word = "";
for (String letter : letters) {
word += letter;
}
return word;
@homelinen
homelinen / board.java
Created September 19, 2011 15:04
Maze generator
/**
* The Board
*
* Need to generate a maze
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
@homelinen
homelinen / drawPlayer.java
Created September 21, 2011 21:51
drawPlayer class
/**
* Draw the player
*/
public void drawPlayer(Graphics2D g2d, Dimension playerSize) {
//Get the players position in terms of cell co-ords
int playerxmin = (teddy.getxPos() + teddy.getChangex()) / cellWidth;
int playerymin = (teddy.getyPos() + teddy.getChangey()) / cellHeight;
//Get the max player x and y
int playerxmax = (playerxmin + (int)teddy.getSize().getWidth()) / cellWidth;
@homelinen
homelinen / KeyboardInput.java
Created September 25, 2011 16:30
My absolutely horrible keyBoard inut method.
/**
* Check the keyboard input and set the player to move
*/
public void keyboardInput() {
int playerx = thePlayer.getxPos() /theDisplay.getCellWidth();
int playery = thePlayer.getyPos() / theDisplay.getCellHeight();
if (theInputManager.isAnyKeyPressed()) {
@homelinen
homelinen / findChasePath.java
Created January 26, 2012 21:12
Method For finding the chase path for an enemy in a maze game
/**
* Use A* algorithm to find the best path to the playerPos
* in the maze: theMaze.
* @param playerPos
* @param theMaze
*/
public void findChasePath(Point playerPos, Maze theMaze) {
Point current;
int cost=0;
@homelinen
homelinen / explore.c
Created February 18, 2012 15:31
Simple Command Line Game
/**
* File: Explore
*
* Description:
* Simple command line navigation system.
*
* Author: Calum Gilchrist
*
**/
@homelinen
homelinen / comedySetup.sql
Created February 25, 2012 14:53
SQL File to setup the comedyclub database. Some insert statements need fixed, and relations.
--
-- Database: `comedyclub`
--
-- --------------------------------------------------------
--
-- Table structure for table `agent`
--
@homelinen
homelinen / queryResults.txt
Created February 28, 2012 13:44
List of Queries and results for database coursework.
1. View the payments for a specific year and month
select * from pay where (extract(month from dateOfPayment) = "02" and extract(year from dateOfPayment) = "2012");
+-----------+------------+---------------+-------------+-----------------+-------+-----------+
| paymentID | employeeID | dateOfPayment | hoursWorked | commissionSales | bonus | contactID |
+-----------+------------+---------------+-------------+-----------------+-------+-----------+
| 2 | 1 | 2012-02-01 | 0 | 0 | 1000 | NULL |
| 4 | 2 | 2012-02-01 | 40 | 0 | 50 | NULL |
| 8 | 3 | 2012-02-02 | 20 | 1 | 0 | NULL |
@homelinen
homelinen / movies.xsd
Created March 22, 2012 20:37
My Horrible XML Schema File
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Structure -->
<xs:element name="movieReviews">
<xs:complexType>
<xs:sequence>
<!--Movies-->
<xs:element name="movies">
@homelinen
homelinen / testing.md
Created March 28, 2012 20:00
Test file for some coursework

#Testing

5 inputs

  1. 3 4 5 - Expect: Right angled, scalene
  2. 1 12 11 - Expect Scalene, obtuse
  3. 4 7 100 - Expect: Not a Trianlge
  4. 1 1 2 - Expect Isosceles, right angled
  5. 6 6 6 - Expect Equilateral, acute