Basic graphics and mouse events, Computer Graphics

Assignment Help:

For this assignment, you will program a game called Pig. Pig is a two-player game where players compete to be the first to reach (or surpass) 100 points. Pig usually involves players taking turns rolling a regular 6-sided die. However, in your computer version of the game, you will simulate rolling a die by generating a random number from 1-6 and then display the number on the screen.

Your program does not have to look exactly like the one above; in fact, we encourage you to be creative with the layout so that you can gain more experience with the graphics APIs. There are some constraints that you have to follow though, which are described later.

The rules for Pig are as follows:

_ Player 1 and Player 2 both have scores that start at 0. There is also a trough, which starts at 0 points. Player 1 goes first.

_ On each turn, the player has the option to either roll or pass.

_ If the player chooses to roll, then he or she rolls the die.

_ If the roll was 2-6, then that number of points is added to the trough, and it remains the same player's turn (he or she may choose to roll or pass again).

_ But, if the roll was 1, then the trough is reset back to 0, the player receives no points, and it becomes the opposing player's turn.

_ If the player chooses to pass, then the number of points in the trough is added to his or her score, the trough is reset back to 0, and it becomes the opposing player's turn.

_ The game ends once one player's score reaches or exceeds 100 points, at which point that player is the winner.


Related Discussions:- Basic graphics and mouse events

Beam penetration method and shadow mask method, Beam Penetration Method and...

Beam Penetration Method and Shadow Mask Method Two methods exist for displaying colors in a CRT monitor - beam penetration method and shadow mask method. Beam penetration metho

Pears son education, What is scan conversion explain the four adverse side ...

What is scan conversion explain the four adverse side effect of scan conversion

Area filling algorithms - output primitives, Area Filling Algorithms Be...

Area Filling Algorithms Before we go ahead with area filling algorithms, a word about pixel addressing and object geometry. You know that line segments are discretized into fin

What are the disadvantages with the boundary representation, Disadvantages ...

Disadvantages with the Boundary Representation (i) It requires more storage than the corresponding half-space method. (ii) There is no guarantee that the object created is v

Curved surfaces, Build a program that allows: 1. using mouse or keyboard...

Build a program that allows: 1. using mouse or keyboard to move around on a set of 16 control points;  2. modify the value (drag along x, y, or z) of a point;  3. display

Determine the perspective transformation matrix, Determine the perspective ...

Determine the perspective transformation matrix upon to z = 5 plane, when the center of projection is at origin. Solution. As z = 5 is parallel to z = 0 plane, the normal is s

What are the advantages of the boundary representation, Advantages of the B...

Advantages of the Boundary Representation (i) This format gives efficient picture generation and easy access to other geometric information. (ii) The changes produced by mos

Definitions of hypertext, Definitions of Hypertext A manner of pre...

Definitions of Hypertext A manner of presenting information online along with links among one piece of information and the other. These links are termed as hypertext links

Differentiate between spatial and temporal interpolations, Question 1: ...

Question 1: (a) Define what you understand by the following terms: i) Pixel ii) Pixel Aspect Ratio iii) Frame rates. iv) Animation In each of the above, use diagr

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd