I recently applied for a PHP programming job and they required me to do a coding challenge. One of the challenges involved simulating the card game war which I found intriguing. I "over-engineered" it as they requested, but I still don't think it was good enough for them. Is there anything I could have done better?

A live example is here: http://dev.lifeboatcreative.com/war/index.php

The rules this game is based off are found here: http://www.pagat.com/war/war.html

Source files are attached.

diafol commented: thanks for sharing - like it +14

Recommended Answers

All 8 Replies

Member Avatar for diafol

the lifeboat link goes to a blank page

I tested the link before posting and it worked. Still does for me....

Member Avatar for diafol

Works now! May have been my system.

Ok, has a cursory look at the code. Seems OK - all OOPed.
However - I would have challeneged them with regard to PHP and told them it was a JS solution that would have been more appropriate. :(
For PHP post, I doubt whether they'd worry too much about the front end - but that's the only thing that I'd have maybe tweaked. How long did this take you to write? Were you under 'Hugh Jackman in Swordfish'-like conditions? :) Did they give you any feedback at all?

//EDIT
Like I said, the frontend - CSS: maybe use a single image sprite as opposed to individual images for all cards. Maybe some JS animations as the wars are a little abrupt.

Javascript would have been better suited for this, I agree, but it was a php challenge.

The front-end was thrown together pretty fast. I wanted to have an elaborate javascript based card animation, but that would have taken too long. A sprite for the cards was in the works, but it would have taken forever to finish creating the image and then coding all the positions into a css file, so I gave up.

They said it should take 2-4 hours, which I found was not possible for me. Maybe I just work slow, but it took 8-10 hours to complete.

They didn't give me any feedback. I was hoping for some either way, but they never responded.

Member Avatar for diafol

I really sympathise KK - I couldn't have produced anything that worked that well in 8-10 hours. 2-4 hours suggest that they were looking for soemthing REALLY simple. perhaps, as you mentioned, you over-engineered it - I noticed the template system. Seems you threw the kitchen sink at it - maybe this was the reason? Dunno. Either way - thanks for sharing the code - should be really useful for the rest of us plebs!

Hello, I'm looking at your code and noticed it's not really up to PHP 5 standards and that's probably why they didn't choose you?

Nevermind. Started really looking into it and saw he did all that. Why wouldn't they hire you? Maybe it was overtkill.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.