Pimping shenanigans

So, I was driving home from work with Mitchell and Lauren in tow - and lo and behold, driving out of the valley, I got pulled up! The only reason they could give me a ticket was the fact that I didn’t indicate while I was sitting in the right hand turning lane, waiting for a green arrow. So I had to blow into the little machine, and establish the fact that yes, while I was at work, and while walking from work to the car, I had not gulped down a large amount of alcohol and then decided to break the law. Not only that, but when they spent a good five minutes sitting in their car playing with each other, they couldn’t find anything in their computers about the fact that I killed all those little old ladies at the old folks’ home. Apparrently his carputer was broken, I still think it was masturbation - either way, there was some wanking going on that wasted my time. Thanks Queensland Police!

[Read More]

Another Engine for the Gemini

Ok, so going by the topic, you’re thinking that either I’ve gone mad, or my hoarding skills have been redirected to another goal. Well, I’m already mad, and a little bit of the second part is coming into play here, but there is method to my madness (no, really! there is!) Basically, I’m spending over two grand on a G180 engine for the gemini - and that’s just the motor, not including fuel system and other stuff.

[Read More]

Pimpmobile Update

So, there was a weird smell coming from the van when it was warm, which was nearly a clutch smell, nearly a hot brake smell, and nearly a whole lot of things. The weird thing is, it wasn’t coming from the driver for once, it was the car! Seems that the automatic transmission needed a good service, so that’s what we did last night. Full flush of the auto trans fluid and new filter/gaskets was the order of the night, including checking the settings on the bands. After all that, there’s no more smell, and it seems to run a bit better as well. The reason for the smell is the fact that the auto fluid was frothing (don’t ask me why or how, it’s probably something to do with overused/old fluid) and venting through the top - trimatics have a little vent at the top so they can do that.

[Read More]

Asking Queensland Transport

So, I’m spending all this money on a car that I’m building, and I didn’t check to see if it was actually going to be legal for me to

drive it on the road - good going me. Luckily (as you’ll see if you read below) it seems that the modifications that I’m going to do are fine, as long as I don’t turn it into a big polluting crazy machine. Which is fine - because I’ll be tuning it for best efficiency, which also means best burn/least emissions (normally.) Below is the final response including the other bits I sent/received.

[Read More]

Yay for internet fucktards.

Ok, so I posted a reply (now reported by the thread owner and deleted by the mods) to a thread on the Overclockers Australia Forums because, quite frankly, the thread the person wrote sucked. The writer is well known for his complete lack of coherency when posting, or chatting on the #overclockers IRC channel.

[Read More]

Birthday present weirdness.

Ok, I’m not a big fan of birthdays, always a bit over all the attention and crap that goes with them. I really had to post something that was written on the two cans of deoderant I got though.

One’s called 38.2 degrees celsius

Immediately prior to knocking on heaven’s door, the average female will experience a dramatic increase of body heat and would notice a temperature reading of 38.2oC if the services of a thermometer could be utilised at this point. A male wearing Lentheric 38.2 however, would maintain coolness throughout.

[Read More]

Boredom strikes again!

Ok, Ok, I have to stop doing people’s homework for them… but this one was a challenge!

/*
** file: Pegs.java
** created: 02/04/05
** author: Craig Lester
*/

import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.lang.Math.*;

public class Pegs {

int matches = 15;
int player = 2;
int remnum;

int board[][] = new int[9][9];

public void setupboard() {
int r = 0;
int c = 0;

for (int n = 0; n < 7; n++) {
for (int m = 0; m < 7; m++) {
board[n][m] = 1;

if (n < 2 && m < 2){
board[n][m] = 0;
}

if (n < 2 && m > 4){
board[n][m] = 0;
}

if (n > 4 && m < 2){
board[n][m] = 0;
}

if (n > 4 && m > 4){
board[n][m] = 0;
}
}
}

}

public void drawboard() {
int r = 0;
int c = 0;

System.out.println(" 0 1 2 3 4 5 6");
for (r = 0; r <7; r++){
System.out.print(r +" ");
for (c = 0; c <7; c++){
switch (board[r][c]){
case 1:
System.out.print(". ");
break;
case 2:
System.out.print("* ");
break;
default:

System.out.print(" ");

}

}
System.out.println();
}

}

public int countspots(){
int count = 0;
for (int r = 0; r <7; r++){
for (int c = 0; c <7; c++){
if (board[r][c] == 1) {
count++;
}
}
}
count--;
return count;

}

public void placepegs() throws IOException {
int maxpegs = countspots();

BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
Random generator = new Random();
int x = 0;
System.out.println();
System.out.print("Enter number of pegs
to randomly place on Peg Solitare board >> ");
System.out.flush();
x = Integer.parseInt(in.readLine());
if (x > maxpegs){

System.out.println("Pegs amount greater than maximum allowed for this
board, using maximum instead");
x = maxpegs;
}

System.out.println();

//if (x == 0 )

int r = 0;
int c = 0;
while (x > 0){
r = generator.nextInt(7);
c = generator.nextInt(7);
if (board[r][c] == 1){
board[r][c] = 2;
x--;
}

}

}

public void play() throws IOException {
String y[] = new String[7];
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Random generator = new Random();

y[0] = " ";
// asks for the user to input four moves
for (int r = 1; r < 4; r++){
if (y[r-1] != ""){

System.out.println("Please enter move, seperated by spaces");
y[r] = in.readLine();
}
}

for( int test_loop = 1; test_loop < 4; test_loop++ )
{
System.out.println(y[test_loop]);
}

// iterates thorugh the ... something?+
System.out.println("Testing now...");
for (int s = 1; s < 4; s++)
{
// System.out.println("Testing entry "+s+" now...");
int z[] = new int[5];
if (y[s] != null)
{
//System.out.println("DEBUG " +y[s]);

StringTokenizer ts = new
StringTokenizer(y[s]);
// goes through each token in the string

for( int test_loop = 1; test_loop <= 4;
test_loop++ )
{

z[test_loop] =
Integer.parseInt(ts.nextToken());
}
//System.out.print(z[s]);
}

int Valid = 0;
int x1 = z[1];
int y1 = z[2];
int x2 = z[3];
int y2 = z[4];
int xvec = 1;
int yvec = 1;
if( x1 > x2 )
{
xvec *= -1;
}
if( y1 > y2 )
{
yvec *= -1;
}
System.out.println( "\nTesting movement from "+x1+","+y1+" to "+x2+","+y2 );
// has the start position got a peg in it, and is the move a valid spot?
if( board[x1][y1] == 2 && (
( ( ( x1 >
1 || x1 < 5 ) && ( y1 < 2 || y1 > 4 ) ) || ( y1 > 1
&& y1 < 5 ) ) &&
( ( ( x2 >
1 || x2 < 5 ) && ( y2 < 2 || y2 > 4 ) ) || ( y2 > 1
&& y2 < 5 ) ) ) )
{
// calculate the movement vector
int movex = Math.abs( x1 - x2 );
int movey = Math.abs( y1 - y2 );
// is it moving two spaces?
if( ( movex ==
2 && movey == 0 ) || ( movex == 0 && movey == 2 ) )
{
//System.out.println("movement checked out");
// if the destination is clear
if( board[x2][y2] == 1 )
{

//System.out.println( "destination is clear" );
// if there is a peg to jump over

// this is where it's jumping over

int checkjumpx = x1 + ( Math.abs( movex / 2 )
* xvec );

int checkjumpy = y1 + ( Math.abs( movey / 2 )
* yvec );

//System.out.println( "check spot :
"+checkjumpx+","+checkjumpy);

// check if the spot it's jumping is a peg

if( board[checkjumpx][checkjumpy] == 2 )
{

System.out.println( "Valid"
);
Valid = 1;
}
}
// if the destination has a peg in it
else if( board[x2][y2] == 2 )
{

//System.out.println( "Destination has a peg
in it already" );
}
// if the destination is off board
else
{

//System.out.println( "Destination off board"
);
}
}
// if it's moving too far
else
{
//System.out.println("x movement was: "+movex );
//System.out.println("y movement was: "+movey );
}
}
// if there was no peg to grab in the first place
else
{
//
System.out.println( "no peg at "+x1+" "+y1+" value was "+board[x1][y1]
);

//System.out.println( "invalid move, either peg not there, or out
of bounds" );
}

if (Valid == 0)
{

System.out.println("Invalid");
}

}

}

public void game() {
System.out.println ("Java Pegs Game");
System.out.println ("=============");
System.out.println ();
setupboard();
try {
placepegs();
}
catch (IOException i) {
System.out.println("Erronous Input");
}

drawboard();
try {
play();
}
catch (IOException i) {
System.out.println("Erronous Input");
}
drawboard();

}

public static void main(String[] args) throws IOException {
Pegs tpo = new Pegs();
tpo.game();
}

}

 

[Read More]

Boredom creates programs!

This is what happens when I’m bored - a mate of mine messaged me for a tip on how to write a program for his homework at uni - I ended up writing the whole program as a test for myself in Python.

#!/usr/bin/python
#Craig: Write and test a method that returns the sum of all factors of a given positive integer n, where the factors include 1 but exclude n itself. For example, the sum of the factors of 12 is 16 (1+2+3+4+6 =
16).  

#yaleman:
#first you have to get the factors
#iterative modulo would be the easiest
number_to_factor = 12
sum_of_numbers = 0
debug = 0
for i in range(1,(number_to_factor - 1 )):

    test = number_to_factor % i
    if debug == 1:
        print "i "+i
        print "test "+test
    if test == 0:
        sum_of_numbers += i

print "Sum of factors of "+number_to_factor+" is "+sum_of_numbers

I think I might have to start looking at some of the bounties for stuff in the open source community - I know how to do some of it, and if I don’t, I can learn!

[Read More]

Gah!

This is amazing, rather than giving us good service and being good to the people, the Queensland Transport department has started allowing Citibank to put credit card offers in registration renewal letters. Geez, where will it stop? “Driver’s License - brought to you by McDonalds in the interests of safe driving!” or “Here is your speeding fine, red bull would have given you wings!” “Why drink and drive when you can stay at home and have a blockbuster night?

[Read More]

Lots!

Ok, so there’s been a lot of changes in the last couple of days in James-world. For one thing, Bryants called me back about the engine - the bores are a little more worn than it was first thought, so I have to use +0.040" pistons  - which meant an email to GCP to change my order. They seemed fine with it, saying they would change the order, probably have to charge me, but that was fine.

[Read More]