/teamproject_heaven

<Introduction to Computer & Lab> final project, spring semester, 2016

Primary LanguageC

The Mini-Game Proooogram by 'Mini-game-heaven'

<Introduction to Computer & Lab> final project, spring semester, 2016

Contents
-Project Plan-
1.Introduction
2.Problem Statement
3.Project Objectives
4.Literature Review
5.Project Description
6.Plan of Work
7.Expected Results
8.References
-Implementation-
1.My Part

1

Introduction

  • My team decided to make a program of mini-games.
  • Each team members will write a program of different mini-games.
  • User will get to choose one of five mini-games.
  • And the selected game starts!

Problem Statement

4

Project Objectives

  • Practice making flowcharts
  • Apply flowcharts on writing source codes
  • Practice making source codes in own
  • Design and make a program by ourselves(team people)
  • Make a simple game using what we learned during class

=> Application of learnings from class

Literature Review

6

Project Description

  • When a user opens the program, there will appear some options of mini-games. The user selects one of them and becomes a player.
    • Rock scissors paper game
    • Dice tossing game(my assignment)
    • Guess the dice number game
    • Baskin Robbins game
    • Up & Down game

My Assignment

Player sets a goal to move. He/she then sets how many times he/she will throw the dice.
Computer will give dice numbers in random as the number of repetition.
If the sum of dice numbers is same with or bigger than the number of goal, the player wins.
If not, the player loses.

Plan of Work

8

Expected Results

9

References

Literature Review: http://www.justanswer.com/computer-programming/3l16w-create-dice-rolling-game-game-allow-user.html

My Part

int goal, toss, a, dice, sum = 0, conti;

printf("\n<<Dice Tossing Game!!>>\n");

for (;;)
{
  printf("\nSet your goal in number. Goal must be larger than 0.\n");
  scanf("%d", &goal);
  if (goal <= 0)
    printf("Goal must be larger than 0.\n");
  else
    break;
}

for (;;)
{
  printf("How many times will you toss your dice?\n");
  scanf("%d", &toss);
  if (toss < 1)
    printf("You should toss your dice at least once.\n");
  else
  {
    printf("You will throw dice %d times.\n", toss);
    printf("Your goal is [%d].\n To start game, press Enter.", goal);
    getchar();
    break;
  }
}
getchar();

srand((unsigned int)time(NULL));

for (a = 1; a <= toss; a++)
{
  dice = rand() % 6 + 1;
  sum += dice;
  printf("No.%d Dice number is [%d].\n", a, dice);
}

for (;;)
{
  printf("You moved %d.\n", sum);
  if (sum < goal)
  {
    printf("You lose :( \n");

  }
  else
  {
    printf("Winner! :) \n");

  }
  printf("Thank you for playing~\n");
  exit(0);
}
break;