Well. I say, another programming blog. Those not of this nature look away now.
Right good, okay, so. Another virtual machine is in the works, this time with a better error handling system. Previous virtual machine's I've written have involved throwing exceptions that are caught externally - outside of the virtual machine. This one, however, now throws an interrupt on an error - as a real computer would.
The virtual machine is, technically, finished. It just requires that I write an assembler for it, and then plug 'devices' into it.
I'll quickly explain what I mean by 'devices' in the context of this virtual machine. Well, you see, I decided that (against all current traditions of computers) that I don't like memory-mapped input/output between the processor and other hardware. I decided to invent my own instructions! This can only go well.
I made up an "OUT" and "GET" instruction, each of which take two registers as arguments. OUT uses one register to specify a data port, whilst the second register is used to specify what data is actually transmitted onto the output buffer. The GET instruction retrieves the next piece of buffered data sent to the processor, storing the port number it came from in the first register specified, and storing the value in the second register.
If the buffer is empty, GET blocks execution. Something that is probably frowned upon, but I'll be writing interrupt handling routines to deal with this sort of thing.
So yes, this virtual machine is a full attempt at emulating a fictional but working miniature computer. It's currently configured to simulate a machine with just under 30 instructions, 64 megabytes of RAM and a prioritised interrupt queue (more on this part later).
The instruction set was designed to remove ambiguity, none of this variation stuff. MOV copies a value from one register to another, and that's it. The only variations are the size of the move operation, which is defined by the size of register involved. If you want to store a constant in a register, you use SET. If you want to load a memory location into a register you use LD.
Even indirect addressing is done using the same instructions with no additional information. If an address argument to an instruction is 0000, instead of using 0000 the instruction uses the contents of register AD as the address (AD-dress, get it?). If you want to actually address location 0000, then you just have register AD set to zero. I also have support for base addressing, with the register BA (Base-Address, I would've used Base Pointer (BP) but that is the exact name of the register used to point to the bottom of the stack) which is always added to addresses in instructions that use them.
The indirect addressing register and base address register could theoretically be used in unison but you might have to be insane and used to programming in malbolge.
I implemented the base addressing after a computing lesson where a practice paper required you to know the difference between index and base addressing (it's still a little fuzzy, it just seems that index addressing uses a memory location as a base, whilst base addressing uses a register as the base) and I realised that support for relocatable code in my virtual machine was going to be a PITA without it.
In case you're wondering from the previous post, yes relocatable code is very much an aim for this virtual machine. Ideally I'd like to get a very, very simple operating system going in this thing. I'll be happy when I've got the basic ROM finished for it implementing it's BIOS. I need to write the interrupt service routines and populate the IVT in that, which is fun - and I'm not even joking, it actually is.
Back to the interrupt queue (scroll up if you forgot about me saying I'd come back to it later :o).
Now I've implemented error handling as interrupts, the machine needs to be able to comprehend the fact that an interrupt service routine could cause an error and needs to be able to react to that. In my previous virtual machines, a coding error resulted in the virtual machine just crashing, so this was never an issue and interrupt service routines would have un-stoppable control of the machine, disabling other interrupts during their execution. Handling an error inside an interrupt involves the machine being able to prioritise the error, and consider it more important than the current interrupt service routine thus executing code to deal with the error.
I've solved this so far by using a priority queue to store queued interrupts, so even if you mash the keyboard that divide by zero error is still the first one on the queue. This doesn't solve interrupts being caused during an interrupt service routine. I just wrote a large piece about how I planned to solve this problem, and then realised that I already have solved it. I have a variable which tracks the current interrupt number being executed, allowing me to compare it's "importance" with the new interrupt being thrown. If it's more important, it's called, simply put. Then the code just naturally deals with things in the right order. However, I do notice that the way I track what interrupt is currently being executed becomes void when returning from a nested interrupt, so it'll have to become a stack...
I have to write an assembler next as the virtual machine is now, as I said, essentially complete except for a few details discussed above. I need to make it run in a graphical window instead of a console so I have full control over the input/output method. Windows consoles have all sorts of silly things like no key input without a newline/enter-key etc. Then I need to make input/output so keyboard input and console output work nicely. After that it's done.
The assembler is going to be written in python, partly because mmm python but mainly because last time I wrote a virtual machine I had three sources of errors: the virtual machine, the assembler and the assembly code written to be assembled by my assembler. Writing in python means a little bit of the hard work will be off-loaded to magical programming pixies and my problems will just melt away.
That's enough for now, I'm distracted, somebody seems to be playing a flash game with magnetic eggs. Bye :O!
Friday, 8 May 2009
Saturday, 2 May 2009
The day has finally arrived...
Yes, it's that day. I have a whiteboard!

"So what?" you might ask! My friends, a whiteboard is the pinnacle of awesome!
When programming, these things are just unbelievably useful to draw out ideas or help visualise that mess of pointer casting! Heck, when I was first starting to program I used to (as silly as it sounds) struggle with visualising the substring functions and sometimes had to jot down the string I was working with and work out the numbers on paper.
Also, I like to make notes of ideas and post-it notes are (whilst colourful) not the best for that in my room. A whiteboard to collect all my thoughts on is awesome. Not to mention I'm a maths student and for some reason maths just becomes that much easier on a whiteboard! Why? WHO KNOWS!
Currently unsure as to whether I should implement the virtual machine I currently have planned on it, or to wipe it off (after perhaps photographing it for later use) and plan out a game I'd love to make...
Ideally at some point I want to make a finished, playable game. That's difficult, by the way. Playable has a whole host of meanings, and normally in my programming 'playable' or 'finished' means I can use it. Unfortunately this is mostly the case because 'I' programmed it, and to anyone else it's just an un-intuitive... thing. Games I make tend to have no interfaces, just "Golly gee I hope you know what buttons to press 'cos I ain't tellin' yah!".
I want to make a survival game, kind of like normal "LIVE AS LONG AS YOU CAN!" games, except persistent. Dieing would be more of a re-start the current day than restart the whole game. The idea of opening up the game and remembering where you last saved; "Ah yes, it's 8:49 in the evening and I'm running low on ammo. It's getting dark soon and it's going to get messy...".
Kind of like S.T.A.L.K.E.R, but with less fail, 2D and more epic win. That sentence classes as a game design document, right? I'm sure it does. Also, cookies are delicious! Unless it's the LG Cookie, which in a short review I'll give it right here:
The LG Cookie sucks. It's touch screen is laggy, its (STUPID) flash interface is slow and it's text entry system likes to abitrarily delete words that you're trying to write because, oh, I don't know, it's hormonal? Whatever.
Don't buy one. Never in your life. No seriously, don't.
The Caldari Militia is as fun as ever, we hit 'em hard the other night and yesterday space was quiet as hell - the Gallente were clearly still licking their wounds! Owned.
We had a crap fleet commander, though. Hailed as being some awesome guy who'd been to nullsec and was coming back to lead us... turned out to be somebody who used three of the fleet to do everything when there were 20 of us sitting there doing nothing - listening to the three sucke- er, scouts get owned as they were commanded to do obscenely stupid things.
Me and vonstilton are racking up the kills now ;)
BLACKBIRD POWER!
HUUFF HUUFF!
Ttyl.

"So what?" you might ask! My friends, a whiteboard is the pinnacle of awesome!
When programming, these things are just unbelievably useful to draw out ideas or help visualise that mess of pointer casting! Heck, when I was first starting to program I used to (as silly as it sounds) struggle with visualising the substring functions and sometimes had to jot down the string I was working with and work out the numbers on paper.
Also, I like to make notes of ideas and post-it notes are (whilst colourful) not the best for that in my room. A whiteboard to collect all my thoughts on is awesome. Not to mention I'm a maths student and for some reason maths just becomes that much easier on a whiteboard! Why? WHO KNOWS!
Currently unsure as to whether I should implement the virtual machine I currently have planned on it, or to wipe it off (after perhaps photographing it for later use) and plan out a game I'd love to make...
Ideally at some point I want to make a finished, playable game. That's difficult, by the way. Playable has a whole host of meanings, and normally in my programming 'playable' or 'finished' means I can use it. Unfortunately this is mostly the case because 'I' programmed it, and to anyone else it's just an un-intuitive... thing. Games I make tend to have no interfaces, just "Golly gee I hope you know what buttons to press 'cos I ain't tellin' yah!".
I want to make a survival game, kind of like normal "LIVE AS LONG AS YOU CAN!" games, except persistent. Dieing would be more of a re-start the current day than restart the whole game. The idea of opening up the game and remembering where you last saved; "Ah yes, it's 8:49 in the evening and I'm running low on ammo. It's getting dark soon and it's going to get messy...".
Kind of like S.T.A.L.K.E.R, but with less fail, 2D and more epic win. That sentence classes as a game design document, right? I'm sure it does. Also, cookies are delicious! Unless it's the LG Cookie, which in a short review I'll give it right here:
The LG Cookie sucks. It's touch screen is laggy, its (STUPID) flash interface is slow and it's text entry system likes to abitrarily delete words that you're trying to write because, oh, I don't know, it's hormonal? Whatever.
Don't buy one. Never in your life. No seriously, don't.
The Caldari Militia is as fun as ever, we hit 'em hard the other night and yesterday space was quiet as hell - the Gallente were clearly still licking their wounds! Owned.
We had a crap fleet commander, though. Hailed as being some awesome guy who'd been to nullsec and was coming back to lead us... turned out to be somebody who used three of the fleet to do everything when there were 20 of us sitting there doing nothing - listening to the three sucke- er, scouts get owned as they were commanded to do obscenely stupid things.
Me and vonstilton are racking up the kills now ;)
BLACKBIRD POWER!
HUUFF HUUFF!
Ttyl.
too lazy; didn't read...
cookies,
gaming,
programming,
review,
S.T.A.L.K.E.R,
whiteboard
| Your reactions: |
Thursday, 30 April 2009
"We just needed to remind these people that the Caldari are the low-sec concorde!"
So, having joined the Caldari militia I was preparing to fear for my (virtual) life. As far as EVE pilots go I'm pretty poor, so my choices in what ship to fly are limited to what I consider "expendable".
Unfortunately, that limits me to frigates. I'm an ECM pilot, in a thirty man militia fleet op, in a Griffin.
It's almost shameful. Still, I'll have you know that I jammed several ships with my (totally 1337) ECM powers. Including two insta-jam cycles on a Myrmaddon, although it got away because we were on a gate camp and it jumped through.
It was a great evening for a militia op, it's my second ever attempt at one and I went from zero kills on the killboard to 6 - even though I only assisted using ECM magic. Allegedly making me a party to over 0.25 billion ISK of damage! I was chuffed with it. My friend who was also in the fleet recorded a 30 second (damn you fraps!) video of part of the fight.
I find it hilarious that we were initially just going after pirates, waiting for wt (war targets) to be spotted. Imagine that a gang of about 4 or 5, maybe 6 pirates are floating around trying to get a few kills on people... and then they're absolutely incinerated, obliterated and humiliated by a thirty man fleet of organised ships. Ow.
However, eventually it was getting late - about half eleven. We'd encountered a large fleet of ships, who coincidentally were also large, and it ended up with us forming a gate camp on one side with the enemy fleet of war targets hanging around on the other side. Then they tried to lure us down a pipe (inevitably a trap) and as our fleet moved out me and Vonstilton called it a night, jumping to the nearest hi-sec system and docking to recover from the excitement of a great fleet operation :D!
I hope for more EVE fleet ops soon! :)
Unfortunately, that limits me to frigates. I'm an ECM pilot, in a thirty man militia fleet op, in a Griffin.
It's almost shameful. Still, I'll have you know that I jammed several ships with my (totally 1337) ECM powers. Including two insta-jam cycles on a Myrmaddon, although it got away because we were on a gate camp and it jumped through.
It was a great evening for a militia op, it's my second ever attempt at one and I went from zero kills on the killboard to 6 - even though I only assisted using ECM magic. Allegedly making me a party to over 0.25 billion ISK of damage! I was chuffed with it. My friend who was also in the fleet recorded a 30 second (damn you fraps!) video of part of the fight.
I find it hilarious that we were initially just going after pirates, waiting for wt (war targets) to be spotted. Imagine that a gang of about 4 or 5, maybe 6 pirates are floating around trying to get a few kills on people... and then they're absolutely incinerated, obliterated and humiliated by a thirty man fleet of organised ships. Ow.
However, eventually it was getting late - about half eleven. We'd encountered a large fleet of ships, who coincidentally were also large, and it ended up with us forming a gate camp on one side with the enemy fleet of war targets hanging around on the other side. Then they tried to lure us down a pipe (inevitably a trap) and as our fleet moved out me and Vonstilton called it a night, jumping to the nearest hi-sec system and docking to recover from the excitement of a great fleet operation :D!
I hope for more EVE fleet ops soon! :)
Thursday, 23 April 2009
w00t!
I would just like the world to know, my computing coursework is now finished. Yes, that's right.
Finished.
Sorry, I just want to say that again.
My computing coursework is finally finished.
Mmmm. It feels good to say that. Finished.
Yeah, so I'm happy about that. I do, however, still have less than four weeks until my exams and very little physics and maths revision under my belt. I'll leave you to guess as to how stressful that is by yourselves, but here's a hint, an insight from my mind: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARGH!"
Just sayin'.
I wish all UK A-Level exam takers good luck for the up-coming weeks. Anyone else taking exams, good luck to you also, but I don't know where else has exams around May/June? Except of course secondary schools. They have GCSEs around now, don't they?
Whatever, I'm at college now, I don't have a lesson until 11:30 but I've been here since about 8:30, as is my tradition. It sounds weird but it turns out it actually takes less effort for me to get here really early than it does for me to get here 'on time'.
I really need to revise. *sad*
Oh, by the way. Left 4 Dead survival mode is out. It is very awesome. I shall have to post images at some point in the future, oh yes. As it is the awesome. You never saw so many special infect in your life! It's also very hilarious, I might add.
I'll post again Soon (TM)!
Finished.
Sorry, I just want to say that again.
My computing coursework is finally finished.
Mmmm. It feels good to say that. Finished.
Yeah, so I'm happy about that. I do, however, still have less than four weeks until my exams and very little physics and maths revision under my belt. I'll leave you to guess as to how stressful that is by yourselves, but here's a hint, an insight from my mind: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARGH!"
Just sayin'.
I wish all UK A-Level exam takers good luck for the up-coming weeks. Anyone else taking exams, good luck to you also, but I don't know where else has exams around May/June? Except of course secondary schools. They have GCSEs around now, don't they?
Whatever, I'm at college now, I don't have a lesson until 11:30 but I've been here since about 8:30, as is my tradition. It sounds weird but it turns out it actually takes less effort for me to get here really early than it does for me to get here 'on time'.
I really need to revise. *sad*
Oh, by the way. Left 4 Dead survival mode is out. It is very awesome. I shall have to post images at some point in the future, oh yes. As it is the awesome. You never saw so many special infect in your life! It's also very hilarious, I might add.
I'll post again Soon (TM)!
| Your reactions: |
Tuesday, 14 April 2009
Okay, so 7 months later...
Yeah okay so I missed a few posts. Maybe many.
Okay lots. Still, here I am. I'm 18 now, don't you know! That's quite cool.
I bought GTA IV recently for the PS3, golly gee whizz it's awesome. What's novel is the total lack (without a USB headset, do you have a USB headset? I don't, who on Earth has a USB headset!?) of ways to communicate with other players in multiplayer. You have to resort to primitive dance, the whole actions speak louder than words.
Of course this is difficult when everybody elses actions just seem to say "BANG BANG! U DED!". It's a tough life, GTA. I mostly like the helicopters. They are muchos cool.
Also worth note, technically complete a campaign on Left 4 Dead with the difficulty on Expert the other day - even survived the Last Stand. Sadly I had joined this particular game half way and got no achievement. *sadface*.
A point here, feel free to add me on playstation network. My username is, coincidentally, PiedotTaste. I mostly play GTA IV or Killzone 2 (similarly awesome).
College is 'interesting' at the moment (despite how I'm in the Easter holidays?). I have less than five weeks until I must sit my A-Levels, the results of which shall determine my ability to attend university. Good fun.
I need to achieve BBC to get into my chosen university, Aston, in Birmingham. Technically I'm currently working at ABC. These grades - in order to keep them - require that, firstly, I complete my computing coursework.. which is in dire need of some loving. Secondly, I must revise much maths. I'm talking lots of practice, learning trig identities, etc. Thirdly I must do a fair amount of revision for physics.
So this basically boils down to "revise, damnit!". This is true. Unfortunately, 1) Revision sucks. I'm sure you're all aware of this, but I need to re-iterate because of the severe importance of this point. 2) Coursework sucks more than revision. Some of you might disagree. I don't blame you, some people really dig this coursework stuff and find it easy. Give them a checklist and promises of a good grade and they'll go right on and win life. Sadly I fail at coursework, I struggle to make my mind concentrate on it.
Oh yes, I'm rather into animé you know. I haven't mentioned this in my blogs before, but I am.
Mostly since starting college and being guided towards the good stuff by new friends who also have the animé bug.
I'm currently completely up to date with Bleach and Naruto, working my way through the first episodes of One Piece. Bleach is easily the best one, here. It's just great. Naruto is certainly okay and One Piece is shaping up to be fairly good.
The worst thing about getting into an animé is that when you start, you've got over two hundred episodes (in the case of Bleach) to watch (214 episodes as of the time of writing, supposing you were to start now). If you skip the intro and outro of each episode you're looking at about twenty minutes an episode. That's just under three days of animé. It seems like you've got loads to get through and when you have spare time you can just gorge on it. It's wonderful. Then after many gorges and many weeks, you eventually end up at the current day episode. It really hurts if you're mid-gorge. You're getting into the animé and there's a cliff hanger, you go to press 'next episode' as you have the past 213 times... argh! What is this? No... n-no next episode? WHAT IS THIS?
Then you have a little cry, in a dark room. There there, my child. There'll be another episode.. next wednesday.
"WEDNESDAY?" you cry, in anguish.
I'm afraid it's so. Then after that, another week of waiting. The next wednesday.
It hurts. I know. We must endure this for the greater good of animé.
I've also recently discovered twitter, it's pretty cool. The awesome likes of Adam Savage and Grant Imahara from Mythbusters use it, and it's cool to see the stuff they post.
I'm going to go ahead and sate your drooling mouths and tell you my Twitter account name, I know it's hard to guess, .. hey. Calm down, I'll tell you in a second. You rabid fans, you!
It's PiedotTaste. Try not to fight over it and subscribe atll at once or anything, don't want to break Twitter with the sheer mass of you! All... zero readers.
Hrm.
On that note, I bid you adieu!
Swoosh!
Okay lots. Still, here I am. I'm 18 now, don't you know! That's quite cool.
I bought GTA IV recently for the PS3, golly gee whizz it's awesome. What's novel is the total lack (without a USB headset, do you have a USB headset? I don't, who on Earth has a USB headset!?) of ways to communicate with other players in multiplayer. You have to resort to primitive dance, the whole actions speak louder than words.
Of course this is difficult when everybody elses actions just seem to say "BANG BANG! U DED!". It's a tough life, GTA. I mostly like the helicopters. They are muchos cool.
Also worth note, technically complete a campaign on Left 4 Dead with the difficulty on Expert the other day - even survived the Last Stand. Sadly I had joined this particular game half way and got no achievement. *sadface*.
A point here, feel free to add me on playstation network. My username is, coincidentally, PiedotTaste. I mostly play GTA IV or Killzone 2 (similarly awesome).
College is 'interesting' at the moment (despite how I'm in the Easter holidays?). I have less than five weeks until I must sit my A-Levels, the results of which shall determine my ability to attend university. Good fun.
I need to achieve BBC to get into my chosen university, Aston, in Birmingham. Technically I'm currently working at ABC. These grades - in order to keep them - require that, firstly, I complete my computing coursework.. which is in dire need of some loving. Secondly, I must revise much maths. I'm talking lots of practice, learning trig identities, etc. Thirdly I must do a fair amount of revision for physics.
So this basically boils down to "revise, damnit!". This is true. Unfortunately, 1) Revision sucks. I'm sure you're all aware of this, but I need to re-iterate because of the severe importance of this point. 2) Coursework sucks more than revision. Some of you might disagree. I don't blame you, some people really dig this coursework stuff and find it easy. Give them a checklist and promises of a good grade and they'll go right on and win life. Sadly I fail at coursework, I struggle to make my mind concentrate on it.
Oh yes, I'm rather into animé you know. I haven't mentioned this in my blogs before, but I am.
Mostly since starting college and being guided towards the good stuff by new friends who also have the animé bug.
I'm currently completely up to date with Bleach and Naruto, working my way through the first episodes of One Piece. Bleach is easily the best one, here. It's just great. Naruto is certainly okay and One Piece is shaping up to be fairly good.
The worst thing about getting into an animé is that when you start, you've got over two hundred episodes (in the case of Bleach) to watch (214 episodes as of the time of writing, supposing you were to start now). If you skip the intro and outro of each episode you're looking at about twenty minutes an episode. That's just under three days of animé. It seems like you've got loads to get through and when you have spare time you can just gorge on it. It's wonderful. Then after many gorges and many weeks, you eventually end up at the current day episode. It really hurts if you're mid-gorge. You're getting into the animé and there's a cliff hanger, you go to press 'next episode' as you have the past 213 times... argh! What is this? No... n-no next episode? WHAT IS THIS?
Then you have a little cry, in a dark room. There there, my child. There'll be another episode.. next wednesday.
"WEDNESDAY?" you cry, in anguish.
I'm afraid it's so. Then after that, another week of waiting. The next wednesday.
It hurts. I know. We must endure this for the greater good of animé.
I've also recently discovered twitter, it's pretty cool. The awesome likes of Adam Savage and Grant Imahara from Mythbusters use it, and it's cool to see the stuff they post.
I'm going to go ahead and sate your drooling mouths and tell you my Twitter account name, I know it's hard to guess, .. hey. Calm down, I'll tell you in a second. You rabid fans, you!
It's PiedotTaste. Try not to fight over it and subscribe atll at once or anything, don't want to break Twitter with the sheer mass of you! All... zero readers.
Hrm.
On that note, I bid you adieu!
Swoosh!
Saturday, 13 September 2008
Well hey, would you look at that.
It turns out I've been behind everyone else, I've only just recently discovered the horde of wonderful Google Apps floating around the inter-tubes.
One of the most interesting to me is Google Sites, which seem delicious. Hence forth, I now proudly 'own' (read: maintain?) "Program What?". I don't know how often I'll update it, I guess it's not really important about how often but more about what goes on it.
It's a neat little service, it's nice and easy to create some nice things and looks pretty funky too! 100MB of storage space isn't bad, either!
The look I'm going for is one of a more slightly... professional disposition than my usual Internet activities. Hence the simple, non-intrusive and to the point design. I'm kind of modelling it on the websites I've seen of more accomplished programmers who maintain interesting repositories of their acquired experience and knowledge. That, I guess, is kind of what I'm aspiring for.
So, let's see how this goes, shall we?
One of the most interesting to me is Google Sites, which seem delicious. Hence forth, I now proudly 'own' (read: maintain?) "Program What?". I don't know how often I'll update it, I guess it's not really important about how often but more about what goes on it.
It's a neat little service, it's nice and easy to create some nice things and looks pretty funky too! 100MB of storage space isn't bad, either!
The look I'm going for is one of a more slightly... professional disposition than my usual Internet activities. Hence the simple, non-intrusive and to the point design. I'm kind of modelling it on the websites I've seen of more accomplished programmers who maintain interesting repositories of their acquired experience and knowledge. That, I guess, is kind of what I'm aspiring for.
So, let's see how this goes, shall we?
Thursday, 28 August 2008
Mmm, snakes.
I've recently travelled into the world of another language, one that isn't C++. This is unusual for me, as any of my programmer friends will tell you. I generally love C++, and any foray into another language results in me just wishing I was back in C++.
Some languages have cool features and all, but i'm experienced in C++ (relative to experience in other languages, that is) and therefore think in it. Other languages I have so little experience in that I find myself tripping at every hurdle the language throws at me, eventually getting annoyed and giving up.
This time, however, was different. I've strayed into the path of Python before, it nibbled my leg and hissed at me and I shuffled away in a huff. The thing is, a friend of mine has taken such a liking to python that it has turned up in a vast majority of his recent projects - including the most recent few that have popped up which I may have a part of (maybe!). This means I needed to know it, well enough to be able to think in it and do practical work in it. After a while of getting to grips with it, much like the creator of XKCD comics, i've succumb to it's ridiculously elegant simplicity and ease of use.
Literally, I wrote a goal-oriented action planning (GOAP) library in C++ a few days ago. I thought it was pretty nice, kinda object orientated and neat. Very simple. I show it to aforementioned friend (Ricky) and he points out that, why didn't I do it in python so he can use it?
So I did. What was over 200 lines of C++, not including example code, became around 100 lines of Python INCLUDING example code! Not only was it shorter, more readable and generally nicer.. it was HUGELY more flexible!
The reason for it's massive flexibility actually reminds me of the cause of it's greatest downfall, in my eyes. Python's absolute lack of compile-time type checking (that i'm aware of, sorry if I offend some die-hard python coders) means that the simplest typo that would've triggered all battle stations in a C++ compiler go completely unnoticed. One capitalised letter, one forgetful moment where you access a data member of an object that doesn't exist - congratulations! You now have to spend a good portion of your development time bouncing off the walls looking for your mistakes! Still, it's worth it for it's bonus'.
To demonstrate the sheer power of python, I say this. Normally I need to really want to program something in C++ to get going, the little nagging problems that hold me back from starting a project, that sort of thing. In python, if you can think of a problem, there's normally a library to solve it or the problem doesn't even exist in this language! It's wonderful like that. As a result, since getting into Python i've developed almost five projects that - whilst not complete - demonstrate significant progress with little to no real effort required!
I'm very impressed with Python. I'd like to do some work in C++ but at the moment Python is the language of choice so that I might develop some things for Ricky to use. Namely, some AI tools. I love AI, perhaps one day I'll be good at it!
Speaking of being good at things, not too long ago I made a few more script engines, again. The difference is though, they're noticably more complex than previous attempts which were only slightly better than their predecessors. I'm getting to a point where I can implement script engines pretty efficiently moderately neatly! I'm quite impressed by it all. In fact, I not long ago wrote my first 'real' programming language. As in, the first language that actually compiles to machine code and not a bytecode! I was quite proud of this, and hopefully when I get a dev machine I can use that language to make OS dev a little bit neater :)!
Anyway, that's about it for what I feel like discussing right now. Ciao!
Some languages have cool features and all, but i'm experienced in C++ (relative to experience in other languages, that is) and therefore think in it. Other languages I have so little experience in that I find myself tripping at every hurdle the language throws at me, eventually getting annoyed and giving up.
This time, however, was different. I've strayed into the path of Python before, it nibbled my leg and hissed at me and I shuffled away in a huff. The thing is, a friend of mine has taken such a liking to python that it has turned up in a vast majority of his recent projects - including the most recent few that have popped up which I may have a part of (maybe!). This means I needed to know it, well enough to be able to think in it and do practical work in it. After a while of getting to grips with it, much like the creator of XKCD comics, i've succumb to it's ridiculously elegant simplicity and ease of use.
Literally, I wrote a goal-oriented action planning (GOAP) library in C++ a few days ago. I thought it was pretty nice, kinda object orientated and neat. Very simple. I show it to aforementioned friend (Ricky) and he points out that, why didn't I do it in python so he can use it?
So I did. What was over 200 lines of C++, not including example code, became around 100 lines of Python INCLUDING example code! Not only was it shorter, more readable and generally nicer.. it was HUGELY more flexible!
The reason for it's massive flexibility actually reminds me of the cause of it's greatest downfall, in my eyes. Python's absolute lack of compile-time type checking (that i'm aware of, sorry if I offend some die-hard python coders) means that the simplest typo that would've triggered all battle stations in a C++ compiler go completely unnoticed. One capitalised letter, one forgetful moment where you access a data member of an object that doesn't exist - congratulations! You now have to spend a good portion of your development time bouncing off the walls looking for your mistakes! Still, it's worth it for it's bonus'.
To demonstrate the sheer power of python, I say this. Normally I need to really want to program something in C++ to get going, the little nagging problems that hold me back from starting a project, that sort of thing. In python, if you can think of a problem, there's normally a library to solve it or the problem doesn't even exist in this language! It's wonderful like that. As a result, since getting into Python i've developed almost five projects that - whilst not complete - demonstrate significant progress with little to no real effort required!
I'm very impressed with Python. I'd like to do some work in C++ but at the moment Python is the language of choice so that I might develop some things for Ricky to use. Namely, some AI tools. I love AI, perhaps one day I'll be good at it!
Speaking of being good at things, not too long ago I made a few more script engines, again. The difference is though, they're noticably more complex than previous attempts which were only slightly better than their predecessors. I'm getting to a point where I can implement script engines pretty efficiently moderately neatly! I'm quite impressed by it all. In fact, I not long ago wrote my first 'real' programming language. As in, the first language that actually compiles to machine code and not a bytecode! I was quite proud of this, and hopefully when I get a dev machine I can use that language to make OS dev a little bit neater :)!
Anyway, that's about it for what I feel like discussing right now. Ciao!
too lazy; didn't read...
C++,
programming,
python,
XKCD
| Your reactions: |
Subscribe to:
Posts (Atom)