No rest for the wicked!

So I have pretty much finished my final year of University, but I don’t think I’ll be taking much of a break from the busy life that seems to have become a habit. I’ll be turning my programming energies to programming tools from my day job at Ash Gaming, the aim is to speed up my work flow there, benefiting with deadlines always being met efficiently at a high quality and on time while also benefiting me; giving me more time to read and learn.

I also want to turn my attention to my creative hobbies which have basically been neglected over the last 4 to 6 months. Music, writing and language will all be seeing a lot more post time on the blog.

All this will be done while getting back into the shape I was in before this crazy ass year started! :)

Wish me luck…
-Mikey..

Write write write…

Things are all about the process report no more time for implementation which is getting me down because things still don’t work!!! :(

I’m really unsure about the word count, my friend Dave is telling me he’s aiming for ridiculous amounts of words, either way. I need to start writing now if I’m going to have any chance of possessing a decent write up.

Parallel Processing of Edges

Today I finished implementation on a design I had to allow parallel processing of the resolving movement in the StitchableQuad edge structures. Although it appears to work. When composed with other functions it consistantly crashes. If I leave the processing of the mid quadrants however a small amount of parallelism is geneated in threadscope. Hopefully if I can get the full quadrant processing working in the same processing step parallelism will increase yet again.

Here is the error message that has me stumped.

Simulation Setup…
========
*** Exception: Ix{Int}.index: Index (18) out of range ((0,15))
*Main>

Quickchecking it UP Limiting values.

Today I finally got quick check working my previous test was failling as I expected because of erroneous values being passed to it. after discovering how to make these new generators I wrote three more quick Check funtions.

A instance of Arbitrary needed to be defined but in order to define a limiting type a type was defined with keyword newtype allowing us to use our new type in the example provided here, as an int. This prevents a new function having to be written which only takes the special test variable.

[Wrong code]
newtype IntSmall = Int deriving (Show) instance Arbitrary Is where arbitrary = do i <- choose(0,100) -- or some low value to stop things getting too big return $ Is i prop_keyList :: IntSmall -> Bool prop_keyList x = (length (keyList x) == x^2)

[Right code]

newtype IntSmall = Is Int deriving (Show) instance Arbitrary IntSmall where arbitrary = do i <- choose(0,100) -- or some low value to stop things getting too big return $ Is i prop_keyList :: IntSmall -> Bool prop_keyList (Is x) = (length (keyList x) == x^2)

Discovery of -Wall and hpc

Crazy infinite loop bug while trying to print quadrants after resolving movements between them.

Epic tools of epicness are guiding me to win. Uncovering problems I have with type signatures and shadowing.

Hopefully bug should be fixed soon I have some really cool Warnings being thrown which I had no idea were there.

-Update bug fixed
Fixed

Graph Density Points – An NP-Hard Problem?

I was hoping the project would be smashing through bugs quite quickly at this point but this doesn’t seem to be the case. Anyway, I was looking at the things I wanted to try and achieve in the near future and dividing the quadrants automatically was one of them. in order to increase the amount of ants appearing inside quadrants rather than on the edge of quadrants. I was thinking that the problem might be NP complete.

I was talking to John Howse about the problem of finding a densest point on a graph where the nodes hold binary data, i.e. There is something there, or there isn’t. Like my ant graphs, and he suggested a solution which involved looking at the in-degree for each node and writing a function which gave each node a value depending on how many of the nodes were an in node holding an ant. Using this method the node with the densest area of a small graph can be worked out and it could be expanded out, to a larger graph.

I really doubt I’ll have time to implement this now but I really hope I can.

Printing Worlds

Today I focused on printing world graphs on the console, as getting a GUI with OpenGL is just taking too long. Things were very productive too I managed to expand on a previously written function to display ant quadrants. and using more mod trickery print only specific lines of each quadrant in turn for specific lines of a world graph.

specificLinePrint aWorld row wsiz siz worldCol = do
a <- getLine
let siz = truncate $ sqrt $fromIntegral $length $brokenUpGraph $ fstTrip ((sndTrip aWorld) (0))
let preData = brokenUpGraph $ fstTrip ((sndTrip aWorld) (getGraph row siz wsiz worldCol)) -- pulls out the specific Graph! so only siz^2 elements in pre Data!
let theData = fst $ splitAt siz $snd (splitAt ((row`mod`siz)*siz) preData) -- TODO wsiz chang to local size
putStr("World Col = "++ (show worldCol) ++ " ")
putStr("World Row = " ++ (show row) ++ " ")
putStr("World Siz = " ++ (show wsiz) ++ " ")
putStrLn("Test ")
specialPrintLn worldCol wsiz preData
putStrLn("%")
specialPrintLn worldCol wsiz siz row theData
let moveOn = worldCol+1
if moveOn > wsiz
then printWorldLine (row+1) (worldCol+1) wsiz siz aWorld
else printWorldLine row (worldCol+1) wsiz siz aWorld

One nice thing about working with code like this is that because the function produces IO it is ok to use traditional debuging techniques in order to narrow down problems.

System Crash Dissertation Writing

This weekend my laptop seemed to totally die, I was working on installing wxHaskell and everything froze. I had to switch the laptop off manually using the power button but when it restarted it wouldn’t let me log in.

I didn’t realize until 5 hours later that I could log in but only under Gnome Classic.

PAIN!!!!!!!! >.<

-Mikey

Debugging Parallel Functions

A few notes on me trying to debug my problems with the Evaluation Strategies approach to parallels

– I know
zipWith ($) :: [b -> c] -> [b] -> [c]
parMap rpar :: (a -> b) -> [a] -> [b]

– I have the functions
aQuads :: [GraphATuple]
pQuads :: [GraphPTuple]
processAQuadrant :: GraphATuple -> GraphPTuple -> GraphATuple

{- I’m trying to write a function which process the aQuad list using the pQuad List as parameters in parallel -}

–my attempt

runSimParallel aQuads pQuads = parMap rpar (zipWith (processAQuadrant aQuads $)) pQuads