Parrot is Fun!

Published September 06, 2006
Advertisement
Design Document
This morning I started up on the design document for Spherion and so far its coming out well. I can't stress how much it has helped to write a story out on digital paper. Even if you are not an excellent writer, writing a story out before you start writing up the design document can help you ten-fold. Not only that, but, by the time you have finished writing the story, you will have a very solid grasp of exactly what is going to take place in your concept world.

I started writing August 20th and finished it yesterday, September 5th. I gave the story a good hour a day, missing a couple of days doing homework/random things.

So, this morning, like I said, I began on the design document. Well, I have a general idea of what goes into the document, but, I really wanted a template to go off of. So, I did some searching and I ran across a template that the mind behind Dungeon Seige, Chris Taylor, used when he put the imagionation in motion.

For Simplicity, you can Download it Here, and it will be linked on top of the journal soon.

Parrot Assembly Language is Fun!
So, tonight I finally got my hands on a low level language and it was fun! Ha-ha. No, seriously. ;) You can check out parrot by visiting http://www.parrotcode.org/

Here is the program I whipped together in less than an hour. It is well commented, so you can get an idea of what is going on. This is written in PIR (Parrot Intermediate Representation), which is basically between a high level language and assembly. The ASM version of this wouldn't be too incredibly different. I'll probably convert it tomorrow just for kicks. In fact, now that I think about it, ASM would be a bit less combersome.

#-------------------------------------------# This program will take input from the user to# find the number of combinations that can be# selected from 'n' items chosen 'k' at a time## FORMULA: C(n,k)= n! / ((n-k)! * k!)#-------------------------------------------#--------------------------------------------# Computes the factorial of a given number#--------------------------------------------.sub factorial	.param int n	.local int result	if n > 1 goto recurse	result = 1	goto returnrecurse:	$I0 = n - 1	result = factorial($I0)	result *= nreturn:	.return(result).end#------------------------------------------# Computes the number of combinations that# can be selected from n items chosen k at a# time#------------------------------------------.sub C	.param int n			   # Param 1	.param int k			   # Param 2		set $I3, n			   # Set register I3 to n	set $I4, k		           # Set register I4 to k	sub $I5, n, k			   # Subtract n from k store in register I5 	$I5 = factorial($I5)		   # Find Factorial of I5	$I3 = factorial($I3)		   # Find Factorial of I3	$I4 = factorial($I4)		   # Find Factorial of I4	mul $I5, $I5, $I4		   # Multiply register I5 against I5 and store in I5	div $I5, $I3, $I5		   # Divide register I3 against I5 and store in I5		.return($I5)			   # Return register I5 value (solution)	.end#-----------------------------------------# Main entry point#-----------------------------------------.sub 'proj1' :main	read $S1, 10			  # Read Input for 'n'	read $S2, 10			  # Read Input for 'k'	$I0 = $S1			  # Store input for 'n' in register I0	$I1 = $S2		          # Store input for 'k' in register I1	$I2 = C($I0, $I1)		  # Compute Combinations and store in register I2	print $I2			  # Print Result			print "\n".endSample Run:INPUT:  5INPUT:  2OUTPUT: 10


Anyway. If you have any questions, feel free to sling them on over.

Regards,
-Dave
0 likes 1 comments

Comments

Sir Sapo
I was never brave enough to go lower level than C[grin]

BTW, how did that whole mandatory recall thing work out for you? Have they called you up, or are you off the hook?
September 07, 2006 01:35 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Advertisement