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]

CarPC Project Started

Ok, so I’m a geek - I’ve always got to have a lot of geek toys around me, and one of the main things is a computer. I’m building the Gemini, as you all know, and with that is an ECU called a MegaSquirt. Most ECU’s have inbuilt datalogging and storage capabilities, or have the ability to send live data to another system (normally a PC). The MegaSquirt is the second style of unit, logging through the serial interface on a PC. This means that I have to have a PC in the car at all times that I want to datalog - which in my case, is as often as possible, to make sure the car is running correctly and so that I can optimise fuel, spark and eventually boost maps.

[Read More]

Piston order update

It seems that there isn’t many pistons to suit the G180Z these days - the engine hasn’t been made for nearly 20 years, which I guess doesn’t help. GCP sent me an email yesterday saying so, and reporting that the Chrome-Moly rings I was looking for are no longer available. That means I’ll just have to deal with stock steel rings, and upgrade the pistons later when I supercharge. Since the engine hasn’t actually cost me that much, I might go to a 4ZE1 or something like that when I supercharge it, giving me a 2.4lt engine with slightly more modern components.

[Read More]