amat 150 project.docx

Upload: danicaguinid

Post on 14-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 AMAT 150 Project.docx

    1/3

    AMAT 150 Project

    Create a game named 4 in a line chess bingo using Fortran.

    1. How to play the game

    There should be two players; one will be given white chips, and the other will be given black chips. Each

    player will alternately put chips in a 9 by 9 frame. The player with the white chips will go first. Each cell

    of the frame has the same size of a chip. Thus a chip will occupy exactly one cell. The frame is in upside

    position so a.) the first chip of a column will be at the bottom row, c.) no two chips in the same column

    will have a gap with each other. The first player to create 4 consecutive chips in a row, column or

    diagonal will win the game. If all of the cells in the frame are occupied and still no 4 consecutive chips is

    formed, the game will be a draw.

    2. The game in Fortran

    Since there are no colours in Fortran, find a way on how to distinguish white chips from black chips. You

    can use letters W and B, or you can be more creative by making hollow and solid circles. Make sure that

    the frame is nicely displayed.

    Example:

    1 2 3 4 5 6 7 8 9

    W

    B

    W

    B W B

    W B W B B W W

    The program will have a main menu.

    New game

    Continue

    Instruction

    Scores

    OptionsCredits

    Quit

    Continue will only appear if there is a saved game.

    New game- The game will be played. Each column of the frame will be labelled 1 to 9. The user will be

    asked what column he/she wants to drop his/her chips. If a column has already 9 chips, the user will not

  • 7/30/2019 AMAT 150 Project.docx

    2/3

    be allowed to drop his/her chip in that column. There will be also an option to quit the game. When the

    user quits the game, he/she will have an option to save it. In addition, if there is a saved game and new

    game is selected, the user will be asked if he/she really wants to have a new game. By doing so, the

    saved game will be erased. After a game is finished, the program will go back in the main menu.

    Continue A saved game will be continued. Then the same system will be applied like in the new game.

    Instruction- The game will be explained.

    Score There three values displayed in this choice. a.) number of games against the computer, b.) win

    rate against the computer, c.) most number of consecutive wins against the computer. After the Not so

    Easy is unlocked, d.) win rate against the Not so Easy levelled computer and e.) most number of

    consecutive wins against the Not so Easy levelled computer will be added.

    Example

    You played 100 times against the computer.

    Your win rate is 58% against the computer.

    Your highest win streak against the computer is 6.

    Options- There are 4 sub choices.

    Color chooses the color of the user. The default is white.

    Player 1 player or 2 players. If one player, the opponent of the user is a computer. If two

    players, the opponent is another human. The default is computer.

    Difficulty The level of difficulty if the opponent is a computer. It can be Easy or Not so Easy. If

    Easy, the computer will move randomly every time. If Not so Easy, the computer will

    block the fourth cell that will complete the 4 consecutive chips of the user. The

    computer will also try to create 4 consecutive chips of his own. At first, the move of the

    computer is random. The Not so Easy option is first locked. It will be only be unlocked

    after beating the computer in Easy mode 4 times.

    Reset Scores The scores will be reset. If the Not so Easy level is already unlocked, it will go back

    to being locked after resetting. The user must beat the computer in Easy mode 4 times

    to unlock it again.

    The choices of the user will be saved every time a sub choice in the option is changed.

    Credits This will display who created the program.

    Quit It will close the application. The user will be asked if he/she really wants to close the program

    before its termination. Do not forget to thank the user for using the program.

    3.) The source code The main program should have only the following subprograms:

  • 7/30/2019 AMAT 150 Project.docx

    3/3

    Main_menu

    Play

    Sco_Ins_Cre

    Options

    These subprograms can be functions or subroutines. You are free to have any number of parameters.

    You can add subprograms in these subprograms.

    Main_menu Displays the main menu. Also it will get the choice of the user.

    Play If the user choose new game or continue, this subprogram will create the algorithm on how the

    game will be played. The bulk of the program will be in this subprogram.

    Sco_Ins_Cre Displays the scores, instructions or credits depending on the choice of the user.

    Options Give the user the options or quit the program depending on the choice of the user.

    Create exactly 2 text files.

    Scores.txt stores the number of games played against the computer, the number of wins against the

    computer, and highest win streak against the computer. (Both Easy and Not so Easy levels.) The changesin the option will also be included in this text file.

    Save.txt stores a saved game.

    Tips on how to make this project a success:

    1.) Comment the important details in your program. Comments will serve as a guide for yourprogram.

    2.) Name variables in such a way that they are easy to understand. For example, for the value of thewin rate, use variable names like percent instead of say x.

    3.)

    Create as many subprograms as needed. It will make debugging much easier.4.) Coordinate with your partner. Programming is always a team game.

    Good luck.