Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Keenen Topple
- Minesweeper project 1
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- void initilization()
- {
- printf("____________________________Minesweeper____________________________\n");
- printf("***Setting up the Game***\n");
- }
- void tearDown()
- {
- printf("____________________________Destroying_The_Game____________________________\n");
- }
- int worldUpdate(int row, int column)
- {
- while(row > -1 && row < 11);
- {
- printf("Please enter a Horizontal coordinate 0-10 and press enter.\n");
- scanf("%d", &row);
- }
- while(column > -1 && column < 11);
- {
- printf("Please enter a Vertical coordinate 0-10 and press enter.\n");
- scanf("%d", &column);
- }
- if((row=0)&&(column=0))
- {
- printf("BOOM, GAME OVER.\n");
- return 1;
- }
- else
- {
- printf("Okay, No bombs were hit.\n");
- }
- return 0;
- }
- void worldDisplay()
- {
- printf("Display the state of the world – Print the result calculated in the state of the world. Later, this should print the board.\n");
- }
- int acceptInput()
- {
- int row;
- int column;
- char menu;
- printf("____________________________MENU____________________________\n");
- printf("(F) flag a spot as a mine, (R) remove a flag, (A) assert that spot is mine free, (Q) quit the game\n");
- scanf("%c", &menu);
- getchar();
- menu = toupper(menu);
- printf("input: %c", menu);
- switch(menu)
- {
- case 'F':
- {
- printf("Input successfully entered as F!");
- break;
- }
- case 'R':
- {
- printf("Input successfully entered as R!");
- break;
- }
- case 'A':
- {
- printf("Input successfully entered as A!");
- break;
- }
- case 'Q':
- {
- printf("Input successfully entered as Q!");
- tearDown();
- break;
- }
- default:
- {
- printf("Bad input, Try again.\n");
- acceptInput();
- }
- }
- printf("input successful4");
- }
- int main()
- {
- int lost = 0;
- int row;
- int column;
- initilization();
- do
- {
- acceptInput();
- worldUpdate(row, column);
- worldDisplay();
- }while(lost != 1);
- tearDown();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement