C++

Assignment 1


Number Baseball

4549

Kyu Hee(Genie), Jang 


1. Overview

- A main objective

- A reward for fulfilling objective

- A consequence of failing the objective

- A challenge for the players


2. GUI

- Welcome screen

- Instruction screen

- Main game screen

- Result Screen


3. The Reason that I want to make this game


4. Classes


5. Project Plan


6. Milestones


7. Game Flowchart


1. Overview

A main objective

This game is basically a guessing number game. When a player starts the game, computer will pick a 3-digit-number from its data(I’m going to use ‘srand function’ to get those numbers) and a player(pitcher) will guess(pitch) the numbers(balls) within certain limited number of times. For example, in the normal level, a player has 10 chances to guess the numbers within 30 second. Let’s say a computer set 3 digits number as 123 when a player starts the game. A player throws 3 balls(3 digits) at once, such as 192. In this case, two of the numbers entered by the player are matched with the numbers set by the computer(1 and 2). And one of the two numbers is in the same position where the one the computer set(which is 1). Then the screen will show “1 strike, 2 ball”. That is, “strike” means, a player entered correct number in the correct place, ball means a player entered correct number but not in the right place. If a player can not find the exact array of number in limited time and times, he or she will lose the game. This is the simple rule of this game.


A reward for fulfilling objective

A player will be given limited times(easy : 20 innings, normal: 10 innings, hard: 6 innings). There will be a grade according to a player’s performance in each level, such as pass, credit, distinction and high-distintion. If a player spend only three innings to get the right number in the normal level, he/she will get marked as “high-distintion” in the end of the game.


A consequence of failing the objective

Failing the objective in Number Baseball means either a player cannot find the array of number until they spend all the given chances or he/she cannot find it within the given time. If a player fails to get the numbers, he/she can redo the game from the start. Means, there is no special penalty or consequence although they lose the game. It is just a killing time game at this stage(if I study more and understand the logic and computer language better, it can be developed in the more complex way someday)


A challenge for the players

Number Baseball needs only one player unless a player wants to guess the numbers with someone else together. There is no competition or opponent. But in this game, playing chances are limited. Meaning, he/she tries to spend as less times as they can to win the game. The less times they spend, the better grade they have.


2. GUI

Welcome screen

When a player starts game, the screen will say welcome and show the menu as below.

“WELCOME” is made with “#” and menu is made with “*, |, @” keys. Those are also subject to change. It will show simple instructions like how to play, Select Difficulty, Start Game, Quit Game. If player does not know how to play, he/she should press F1 to find out the instruction. If a player press F2, the screen will show three difficulty levels to choose, which are Easy, Normal and Hard. If a player does not select difficulty, the default level is going to be “normal”.


Instruction screen

The instruction screen is going to be look like the one as below. The screen will show how to play the game and explains simple rule for each difficulty such as limited chances. Levels, Rules and times is subject to change as well.


Main game screen

The below is the main game screen. A player will use number key and enter key to play the game. When the player enter 3-digit number and hit the enter, the screen will show how many numbers he/she guesses correctly using strike and ball count. Now it is just a sample captured screen and the layout is subject to change as I develop the game.


Result Screen

When a player finish the game, the result will come as below. The screen will show whether a player lose or win the game, and the number that computer set in the first place. If a player win the game, the computer will give the player a grade such as pass, credit, distinction and high distinction, depending on their performance. 


3. The Reason that I want to make this game

I was going to make Sudoku at first but while I am preparing the game document, I find that the algorithm of Sudoku is too difficult for me. As a very beginner of programing, it is not easy to understand all the logic and command at once, even though those are very simple ones. This number baseball game has a easy logic and I want to start from the simple one so that I can practice and encourage myself. As my understanding of programming is getting better, the logic and functions of this game is going to be complicated.


4. Classes

▶ CHelp

- m_show : show the instruction (how to play)

- m_load : import the instruction from the text file.

▶ CNumber

- m_life : check the level

- m_random : computer will select 3 random numbers.

- m_inning : show the result of each inning

- m_strike : the condition of strike

- m_ball : the condition of ball

▶ CResult

- m_win : show the result when a player win the game

- m_lose : show the result when a player lose the game

- m_grade : print the grades according to a player’s performance


5. Project Plan


6. Milestones

• 30/08/2013 – Searching references & sources                                      • 04/09/2013 – Coding Inning, Strike, Ball classes

• 28/08/2013 – Display screen coding                                                    • 22/09/2013 – Combining all functions

• 30/08/2013 – Making help loader                                                        • 26/09/2013 – Testing

• 01/09/2013 – Coding difficulty select class                                           • 27/09/2013 – Submit the game 


7. Game Flowchart