## Interviewrama

Jun
21

Replace the video’s dialog:
Truck: “Calling all game engineers, calling all game engineers engineers that we are holding interviews for positions in Los Angeles, California.”
Me: ” I’ve got a degree in Computer Information Systems.”

My degree never broke into Big O notation or anything fun, it ended up being much more high level and less mathy (which bothered me).

Overall I think the interview was positive, though I was definitely caught off guard by their programming questions. I feel that me getting a the job could be 50/50, lets just hope that its just me thinking about it too much.

So lets break down the tech questions I faltered at…

(quoted dialog is approximate)

Falter 1) “Say you are designing a boggle game, how would you see if a user inputted value exists in a dictionary”

So other than just initially explaining that you can poll the array of words, also noting that it would take a considerable / noticeable amount of time to go through, I never really considered a problem like this. I had just built a connect 4 game  for another interview (that I now finishing for my own pleasure) which was based on Keith Pomakis’s C code solution for connect 4 which found the winning conditions in a way that I would not have thought of other wise. With that fresh on my mind I thought that it could some how help me with this question. I explained the the solution which was based on the connect 4 engine, but the more I got into it the worse I saw it blow up. In the end, I still had not fixed the problem of searching for a solution in a huge array, instead of a long wait each turn, now I just pushed for an extra long wait in the beginning of the game running.

The interviewers where trying to steer me to the correct solution, it wasn’t until he basically said “how would you find something in a phonebook” when I understood where he was trying to lead me. Basically if I sorted the array, then I could look half way though the array to see if the the first characters matched if not, recursively keep halving it in the direction closer to where i should look alphabetically. The interviewer basically said the I should find the result in at most six steps, I know I’m never forgetting this solution.

Falter 2) “What values do the variables hold? var i:int = 0;  var j:int = i++; var k:int = ++i; and which one is faster?”

I talked this one out correctly: i = 0; j = 0; k = 2; and explained how it could trip some one up.  When the interviewer asked which one would be faster, my gut said ++i but I had no idea why and I raised the point that the majority of the time you see things written ‘var++’.  He asked me to write out what the function for ‘var++’ and ‘++var’ which kind of threw me for a loop. Having worked with actionscript 3 for so long, I got confused with how flash even overloads ‘++’ and how ‘int’ could be passed by reference which really clouded my judgement (which after thinking about working with c# in unity I completely forgot how it you can explicitly pass a references vs a primitive).

So other than goofily trying to put code after a return statement, I ended up figuring this question out much quicker that the first falter.

falter 3) “If you have an object at point1 and you want it to go to point2 in 10 seconds, how would you handle that with a method that has a time delta paramater.”

This one was a bit strange for 3 reasons. Being a flash developer, the majority of the time I have to solve this problem I end up using a tweening engine such as TweenLite:
TweenLite.to( displayObjectToMove, {x:point2.x, y:point2.y, time:10} );

Another scenario is I want to move something towards a rotation degree, but it arrives based on the parameters of the object. (think astroids ship moving).  Usually the object will have a max velocity and possibly acceleration values that are in relation to one second. I usually have to convert the rotation to radian, use a sine and cosine functions to figure out what to assign the current acceleration value, and then add them to the objects current position. This is where my mind went initially when trying to figure this out.

Third scenario is using a physics engine like box2dflash.

Falter 4) “Having expertise in flash really doesn’t matter too much to me. If some one has a solid background in computer science they should be able to pick up any language fairly quickly.”

This one hit hard, basically this statement has the power to completely nullify my programming experience. I have many years of flash experience under my belt, but my interviewers came from a more traditional programming environment where scripting wasn’t the norm (well now I guess you see it more and more with XNA, Unreal engine, and so forth) and things like community built open source libraries and engines were not common. They understand the full structure of code from the lowest level, things that I have recently been diving into with the book I am currently reading and going though the archives of Security Now. Hopefully my familiarity with flash is not overlooked. When I was talking with some to the interviewers, the noted how not having weak events / forgetting to remove events ended up biting them in the butt for example.

One this is for sure, if I get this job I will go back to school and get my Masters in Computer Science.