TotD - Electricity supply

My Thought of the Day, is around electricity supply. We've read in
the news an article around residents within a 2km radius of a proposed
wind farm can now veto such a development. I'm not sure why you
would. I always thought those huge turbines are quite impressive (we
drove past the one in Newcastle a few days ago http://g.co/maps/2k4nk)

So here's the thought... Electricity prices are going up, various
reasons for that, we could even blame Julia Gillard's carbon tax for
that one. Anyway, this is not a political discussion. In normal
business practices, you'll find a common theme around supply and
demand. The demand for power is ever increasing. The average
household now consumes more power than they did 10 years ago. New
televisions, computers, air conditioners, are all common household
appliances, that simply suck up a lot of juice.

So my first thought... As a consumer, if I am willing to PAY for it,
then surely I can CONSUME as much power as I possibly want... Sure...
Why not... but now they'll come and argue about clean power, and how
the power I consume pumps a huge amount of CO2 into the atmosphere.
Sounds like a bit of a guilt trip, but that's just my view.

So what do the power companies think? I'm wondering about this...
They are hiking the prices to the point where they will turn the
behaviour of people in the opposite way. If power is going to become
more expensive, we will look for alternative ways of doing things. Be
it to install solar, wind turbines, or going back to candles and fire
like in the old days. The point is, by hiking the prices, the power
companies are basically cutting their own throats. So if we get to
the day where I can call up Integral and say : sorry boys, I don't
need you anymore, come remove your meter, will they be happy? If we
all start producing our own power, be it with solar powered torches,
or candles around the house, with soaring electricity prices, you
kinda have to wonder what the CEOs of the power companies are
thinking...

To keep a business sustainable, it is important for the business to
evolve with time. If CO2 is a big killer, then the power companies
have to invest in renewable energies. I don't buy into the idea that
I have to pay an extra premium on my bill because they can't manage
their business properly.

By simply cranking up the price won't solve that, but will
inadvertantly drive the consumer to find a different supply all
together.

Feedburner, not so hot anymore

I'm not sure what Google is doing to Feedburner, but they're doing something, and it's not good...
I have Google Apps configured on my massyn.net domain.  It allows me to use Gmail, and all the other Google suite of products under my own domain name.  Very slick.  A problem that has plagued Google Apps, was the disconnect between Google Accounts.  A few months ago, Google realized this issue, and started merging the Google Apps suite accounts with their regular Google accounts.
What this means, is that rather than having a seperate Google account, and a Google Apps signon, they are now one and the same..
But here's the problem...  I had a phil@massyn.net Google Account, and I had a phil@massyn.net Google Apps signin.  At the time of setup, they were not the same account... They were in fact, two distinct accounts, used to access two different things.  Google then went around and started merging the two.  The result was that in Feedburner, I lost all my config, because it was all setup under my phil@massyn.net Google account, NOT the phil@massyn.net Google Apps account.
Can I ask for help? No, because Feedburner does not have a support desk.  Can I call someone?  No.  There is no phone number to call to log a ticket.  The feedburner config still works, but I can't edit it, I can't find stats.  Basically they are useless to me now.
The only means of addressing it is through the forums, hosted on Google Groups.  I have posted 2 entries on there asking for help, but Google is ignoring me.
I have been an advocate for Feedburner for a while, but I am now changing my view.  The value that Feedburner provides is very small.  If you want stats, use Podpress and enable the stats module.  If you want control over the RSS URL, then buy a domain, and setup a static address that you control - a simple .htaccess file can setup a temporary redirect, which works just as well.  In a next chapter, I will tell you how Google lost all my Youtube subscriptions and videos, due to the exact same issue.

Chess update #3

It's been a few weeks since my last chess update.  I reached a point with the code where I had to start from scratch, so to speak.  I learnt a few things in the process.. For one, if you start off bad, you will end up bad.  I've been reading lots of documentation of writing chess playing software, and I was surprised to find such a huge following of chess software writers out there.  In many of the literature I came across, they're talking about writing bug free code, and setting up the memory structures correctly.  It is something I thought I had done right, but sadly, I had to revisit and start again.  Fortunatly I did not have to rewrite everything, as large chunks of my code has been reusable.

So what have I learnt.  Well, if you represent your board as a matrix, or a 2 dimensional array, it's a lot easier to reference and manipulate.  In version 1, I simply used a single scalar variable to hold the board, using a formula to determine the memory position based on the x/y position on the board.  That's all fine, but the code to determine the pawn's move became a real nightmare.. I couldn't believe that the smallest piece on the chess board ended up becoming the most complex out of all of them.

2D arrays are ok, but then I learnt something about perl... 2D arrays are not simply transportable between functions.  Let me explain... In perl, we have a module called "use strict;".  It forces good programming by ensuring all variables are properly declared, and only accessable inside their said procedure.  Writing good and bug free code was important to me, so I used strict from the word go.  It worked well for the most part, until I had to send the 2D array across to a different function.  It worked, for the most part, until I realised that what I perceived to be a copy of the original 2D array was infact the 2D array itself.  Perl, it would seem, when using 2D arrays, are in fact sending the reference to the 2D array, and not the contents of the array itself.  This is not the case for scalar, hashes or regular arrays, just 2D arrays.  This was a bit of a blow, so I had to hack some code to copy the array to another array.  I did not want to do this, but it seems there was no other choice.

The code is now also much faster (relatively speaking)...  I took some shortcuts with version 1, that I intended to fix in version 2.  Writing efficient code is crucial in a CPU hungry application like a chess program.

Sadly I can no longer make the fruit of my labour available for you to try on my website.. The CPU requirements for the script is a bit too intense for GoDaddy, and they keep killing the processes. Understandably so....

So I'm using a 2D array, and an array with meta data.  The meta data is to record things like if castling is still allowed, and if enpassant is to be enforced in the next round.  This data, along with the colour to move is passed to the engine code.  It will then run through 4 levels of moves, and allocate a score to each move.  The score is then tallied up, and the move with the highest score is the one the engine will pick.  This is effectively the core of the application.  In one hit, I found the application evaluated about 600,000 moves.  This is not much, and due to my limited CPU power, and my choice of programming language, I probably won't get much more out of it.  I have started looking at C, and I'll probably start rewriting the code into C at some point, but for now I want something portable between platforms, that doesn't require compiling.

I've still got a bit of work to do.  For the most part, it adheres to all chess rules, including enpassant.  As soon as the engine can play a fairly decent game, I'll work on an ICC interface.  I think once the engine can play a real mean game against some real opponents, only then will I be able to improve on it. 

For now, the hobby is very enticing.  If you haven't tried it yet, I would certainly encourge any would-be programmer to attempt writing a chess playing mean machine... I guess in a lot of ways, Kasparov against Deep Blue has been my inspiration.  I doubt if my little chess engine would ever be able to compete against Deep Blue, but it's worth a try...

Chess update #2

After a couple more hours on the train coding on my chess engine, I've achieved my 2nd big milestone... The program can now move all pieces, and even detect checkmate.  I've played my first "game" against the machine, and I was surprised at how "clever" a simple random generator can be !
I've uploaded my game for you to view.  If you follow the game closely, you'll notice that the computer makes stupid mistakes.  That's fine, because the "engine" is not making any judgment on it's moves, it's just randomly picking the next move based on a list of valid moves.  I did experiment with a move, by moving my knight back and forth to see how the computer would behave.. It behaved like I expected -- random...
I found the lack of castling frustrating, so I'll be coding that next.  En pasant also needs to be included.  A web front end would also be nice, although I probably won't be able to host it due to the high CPU requirements.. Hosting providers are not a big fan of scripts, especially CGI scripts chewing up all their CPU.
Needless to say, I'm quite pleased with the progress I've made this far.  All of the coding done in less than a week is just to setup the board, and determine the next list of legal moves.  Once castling and en passant is included, I'll be in a position to start teaching this thing to play a bit more intelligently.
Interfacing the engine to the internet chess protocol would also be nice, so I can play the software against other computers.  That would help me to test it's strength, and to improve it's playing capabilities.
I've still got a long way to go... So far so good...

Chess program

Ever since I could program, I had the vision of writing my own chess playing software.  It was the combination of my high school sport, with my hobby of computer programming combined, plus the thrill of writing something as challenging as a chess playing computer game.  After how many years, I've finally managed to get the first infrastructure code written for my own chess playing software.
Why do it?  I think for one it's the idea to prove to myself that I can do it.  If I can write the software and get the program to actually beat me at the game, then I'd be impressed, and it would be mission accomplished.
Current status : The core infrastructure is almost fully in place.  The board is presented in memory, with code around it to move pieces around, and check basic validity, for example, when you move a piece, you can't capture one of your own colour.  It does not check for check or checkmate yet, and also does not prevent the king from being taken!  The program can move the pawn, knight and king.  I'm about to code the bishop and rook, and hopefully by the end of the night we'll have the basic workings of a somewhat deranged chess playing software.
The engine is just a random picker.  Yup, the main portion of the code I've been focusing on was to look at the board, and generate a list of all possible moves.  The engine will then (at this moment) just pick one randomly.  Of course the engine is the main area I'd like to focus on, but for now I just need to finish off the core infrastructure.  I guess a few more hours of coding on the train to and from work will wrap that up this week...
So do you want to see the first version?  Well here it is... Do keep in mind, it's still in draft form (VERY draft form), but you get the basic idea.. And yes, the silly thing likes to move pieces back and forth...
The whole thing is written in Perl.. It's probably not the most CPU efficient language, but if the proof of concept works, I may actually attempt to recode the whole thing in C.
In the mean time, I'll continue working on this, and post some updates as I go along.

Chess update #2

After a couple more hours on the train coding on my chess engine, I've achieved my 2nd big milestone... The program can now move all pieces, and even detect checkmate.  I've played my first "game" against the machine, and I was surprised at how "clever" a simple random generator can be !
I've uploaded my game for you to view.  If you follow the game closely, you'll notice that the computer makes stupid mistakes.  That's fine, because the "engine" is not making any judgment on it's moves, it's just randomly picking the next move based on a list of valid moves.  I did experiment with a move, by moving my knight back and forth to see how the computer would behave.. It behaved like I expected -- random...
I found the lack of castling frustrating, so I'll be coding that next.  En pasant also needs to be included.  A web front end would also be nice, although I probably won't be able to host it due to the high CPU requirements.. Hosting providers are not a big fan of scripts, especially CGI scripts chewing up all their CPU.
Needless to say, I'm quite pleased with the progress I've made this far.  All of the coding done in less than a week is just to setup the board, and determine the next list of legal moves.  Once castling and en passant is included, I'll be in a position to start teaching this thing to play a bit more intelligently.
Interfacing the engine to the internet chess protocol would also be nice, so I can play the software against other computers.  That would help me to test it's strength, and to improve it's playing capabilities.
I've still got a long way to go... So far so good...

Chess program

Ever since I could program, I had the vision of writing my own chess playing software.  It was the combination of my high school sport, with my hobby of computer programming combined, plus the thrill of writing something as challenging as a chess playing computer game.  After how many years, I've finally managed to get the first infrastructure code written for my own chess playing software.
Why do it?  I think for one it's the idea to prove to myself that I can do it.  If I can write the software and get the program to actually beat me at the game, then I'd be impressed, and it would be mission accomplished.
Current status : The core infrastructure is almost fully in place.  The board is presented in memory, with code around it to move pieces around, and check basic validity, for example, when you move a piece, you can't capture one of your own colour.  It does not check for check or checkmate yet, and also does not prevent the king from being taken!  The program can move the pawn, knight and king.  I'm about to code the bishop and rook, and hopefully by the end of the night we'll have the basic workings of a somewhat deranged chess playing software.
The engine is just a random picker.  Yup, the main portion of the code I've been focusing on was to look at the board, and generate a list of all possible moves.  The engine will then (at this moment) just pick one randomly.  Of course the engine is the main area I'd like to focus on, but for now I just need to finish off the core infrastructure.  I guess a few more hours of coding on the train to and from work will wrap that up this week...
So do you want to see the first version?  Well here it is... Do keep in mind, it's still in draft form (VERY draft form), but you get the basic idea.. And yes, the silly thing likes to move pieces back and forth...
The whole thing is written in Perl.. It's probably not the most CPU effecient language, but if the proof of concept works, I may actually attempt to recode the whole thing in C.
In the mean time, I'll continue working on this, and post some updates as I go along.
Posterous theme by Cory Watilo