Archived

This topic is now archived and is closed to further replies.

pdstatha

Towers of Hanoi

Recommended Posts

Hey peeps, I''ve been programming for a good while now so I decided it was about time I programmed my first simple game. So what did I choose, an old classic Towers of Hanoi. I''ve been through the description of the problem several times and have formulised this initial list of classes, with their functions and attributes. Any feedback would be greatly appreciated, also what do you think I should use the DirectX API or the Windows API?? Towers of Hanoi class identification Candidate classes v1.0 · User · Pegs · Rings · Rules · Move · Interface · Difficulty · Game · Goal · Message Refined list v1.0 · Peg · Ring · Rules · Move · Interface · Difficulty CRC List v1.0 Class name: peg Responsibilities: Collaborators: · To hold the rings of Ring varying sizes Rules · To recognize whether Move a move is valid or not Class name: ring Responsibilities: Collaborators: · Creates rings of Peg varying sizes Move Class name: rules Responsibilites: Collaborators: · Holds details of the Peg rules of the game Move Class name: move Responsibilities: Collaborators: · Responsible for Ring moving rings from Peg one peg to the next Class name: difficulty Responsibilities: Collaborators: · Holds the settings for each difficulty setting. Part way through the identifying the attributes and functions for each class I realised that I could shorten the class list once again the class list now stands as. Refined list v1.1 · Peg · Ring · Difficulty Identifying the parameters and functions for the classes Class name: Peg Attributes: · itsName : String Functions: · getName() · setName() · addRing() · removeRing() · checkMove() Class name: Ring Attributes: · itsSize : int Functions: · getSize() · setSize() · moveRing() Class name: Difficulty Attributes: · ringNumber : int · itsName : String Functions: · getDifficulty() · setDifficulty() · getName() · setName()

Share this post


Link to post
Share on other sites