wyudong / HangmanGame

Strikingly interview project

Home Page:http://wyudong.github.io/HangmanGame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HangmanGame

Welcome to this page for introducing and archiving my Strikingly interview project: a word-guessing game on iOS.

IMPORTANT NOTE: you need a valid player ID for starting the game. The ID can be found below, but I'm not sure whether it might get expired someday.

Walkthrough

My project is base on the MVC design pattern.

Model

  • RESTfulAPIManager interacts with the HTTP connection and implements all the given APIs in five Objective-C methods with completion handlers.

  • HMString is a subclass of NSString, which reads each character of a word and replaces it with other characters.

  • HMGameMangaer has just one shared instance telling the program whether the player wants to start a new game or continue the last saved game.

View

I define my own category and subclass of FlatUIKit and MBProgressHUD to customize my UI components, such as labels, buttons, text field and progress HUD.

Controller

  • HMWelcomeViewController has three parts.

    • Enter your player ID in the text field.
    • Touch NEW GAME button to start a new game, and this will reset all the saved data.
    • Touch CONTINUE button to continue your last game.
  • HMGuessViewController is for guessing the word and getting the result.

    • Submit your guessing letter with the customized keyboard.
    • Check the progress of the current word and some other stats after every guess.
    • Quit the game or submit your score.

Difficulties that I encountered and how do I resolve them

HTTP request

Before the task, I have never written code to request data via HTTP. The only library I used to deal with the network when developing iOS App is LeanCloud. However, I just know some basic APIs, nothing more in lower level.

So the first thing I do is to learn what RESTful web service is and how to send and receive JSON package. I read an article and manage to send request using both the terminal and an Chrome extension named Advanced REST client. An hour later, I finally understand the whole game flow and the HTTP request and response that I need to finish the game.

Customized keyboard

I want to impress people when playing my game but the default keyboard of iOS which looks dull doesn't meet my requirement, and some keys are redundant for guessing a word. So I decide to design a customized keyboard.

I really have little time to learn Custom Keyboard of App Extension provided by Apple, so the dirty method I come up with is to simulate a keyboard with tons of UIButton. Another thing pissed me off is how to auto layout theses buttons. At last, I make it works and it could be worse :)

Highlights

  • Can I play the game without a player ID?

    What if I continue the game with a different player ID?

The answer is NO. And I have also prepared some nice tips for handling these kinds of uncommon behaviour and server error. Find more funny tips as you find the bugs.

  • Every time you make a guess, the word will shake its body to cheer you up!

  • The keyboard, obviously the one in the second view.

  • The App name: H_ngm_n. Wait, is it an English word?

  • Simple but elegant UI with the help of FlatUIKit.

Screenshots

Welcome

Noob entering ID

Shake it

Noob testing button

Yay!

Big thanks

Thank you very much for giving me such a special interview opportunity. I will never forget the intense but meaningful development time lasted 4 days. Hope you enjoy my work as I do. For more fun, please try another iOS game made by me, 7 Light Year.

About

Strikingly interview project

http://wyudong.github.io/HangmanGame


Languages

Language:Objective-C 99.9%Language:Ruby 0.1%