Dice game?!!?I need help with EVERYTHING!!

Pages: 12
Hi I have to not wan to but have to take C++ as my course

we are given this homework, CAN YOU PLEASE HELP ME!?!? I will be forver gratfull!!

You will develop a simple windows-based game of dice. The game is played once only, and here are the rules for 2 players:

1- You choose if you wish to be player 1 or player 2

2- 2 dice are rolled on behalf of player 1

3- 2 dice are rolled on behalf of player 2

4- The winner is decided as follows:

a. If neither of the outcomes are a double such as ‘1-1’ or ’2-2’ or ’3-3’ or ‘4-4’ or ‘5-5’ or ‘6-6’ one of player 1 with the larger total wins, and if the totals are equal, it is a draw

b. If one outcome is a double, and the other is not, the player with a double wins and the totals will be irrelevant

c. If both outcomes are a double, then the player with the higher double wins, and if the doubles are equal, it is a draw

Marking:

1- You must write 6 functions, each one displaying the result of the roll of dice(displaying a picture/graphic). The outcome of the rolls of the dice MUST be graphic.

2- The logic of the game should be as described above
my professor is not the best,, and is even on probation! :((
We will not do your homework.
Why would your trust someone online to do your homework? I could write a right load of utter bollocks and you wouldn't have a clue what's going on!

I find it hard to believe that anyone isn't being taught what they need. All you need to do is apply a bit of initiative. If you feel your professor is failing at his jobs there'll undoubtedly be bodies at your place of study that will be prepared to deal with it officially.
Love it. Reported posts because we wouldn't help you.

Good luck with your career; it won't be in programming.
I'll play.

How much of this do you recognise, and what do you mean by "graphic"?

1
2
3
4
5
6
int main()
{


return 0;
}
how hard is it to learn this thing:

The wrong way to do things:
1.I have homework to do:
I know ill go to internet and ask random people to do my homework!

2.result: ---> "We will not do your homework"!

The right way to do things:

1. oh i have homework: ill start doing it!

2. runs in to a problem

3. Goes to internet and asks a question about that subject:

example post:

Hi guys I'm making this super awesome DICE simulator and i need some help with the game loop. its seems that its not working properly!

now explain following things:

1. what it should do?

2.what it does that doesn't please you?

3.*insert here what you think is causing the problem*

4. and now copy/paste your code here and use the code tags!

5. and now go trough your code and add explanations what the code does at each part (HINT: USE /* */ for explanation that is expanding multiple lines and // for single line)

*insert the code here*

6. additional questions Here.

and after doing those things you can expect us to help you!

If you expect to learn a programming language you must spend more time in the IDE than on the forums...

Edit: Reporting us will not change our ethics...
Last edited on
graphic means a picture should appear

and offcourse not i;m not doing programmin as my carrer, are you stupid?!?!

this course is mandetory for all engineers, and there is one professor who teches it and he sucks and more than half the people dropped the class

i'm doing mechanical engineering which has nothing to do with programming

at least help me with the graphics,,,, it means when the dice is rolled a pictue has to form!!

If you're going to be an engineer, you're going to have to learn to express yourself clearly, particularly in terms of requirements.

This level of programming is essentially a test of your ability to think clearly and to break a problem down into component parts. So far, you're doing pretty badly.

The simple way for you to handle graphics is to use the keyboard symbols. Here is how you might represent rolling a four.
*************
*           *
*   x  x    *
*           *
*           *
*   x  x    *
*           *
*************


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

int main()
{
cout <<
"***************"  << endl <<
"*             *"<< endl <<
"*     x  x    *"<< endl <<
"*             *"<< endl <<
"*             *"<< endl <<
"*     x  x    *"<< endl <<
"*             *"<< endl <<
"***************"<< endl;
}

graphic means a picture should appear

and offcourse not i;m not doing programmin as my carrer, are you stupid?!?!

this course is mandetory for all engineers, and there is one professor who teches it and he sucks and more than half the people dropped the class

i'm doing mechanical engineering which has nothing to do with programming

at least help me with the graphics,,,, it means when the dice is rolled a pictue has to form!!

Nope, I'm not stupid as illustrated by my ability to form complete sentences with correct spelling and syntax. You can also factor in my initiative, willingness to learn and ability to grasp even the simplest of programming concepts into my "I'm not stupid" portfolio.

I don't profess to know everything, though. That would be silly. For those issues I'm not familiar with I tend to draw out a clear and reasonable idea of what I need help with and, at the very least, give it my best shot before resorting to help. Even then, I like a small nudge in the right direction, rather than asking for the solution, which, if we're to keep up the 'nudge' analogy, is like being hit in the face with a bag full of mallets.

Fact is that nobody wants to deny anyone help here. It's just that there's a gulf between those who want to learn and those who want the answer. The latter are easy to spot, especially when they can't be bothered to drum up the simplest of attempts in the form of a few lines of code.

Good luck with your bag of mallets.

Last edited on
I was in a hurry to respond that's why the sentences were incomplete, I had more important classes than programming.

This class is something that everyone must take, for example I have to take creative writing which really has no use for me since I want to become an mechanical engineer , maybe because for the university to get more money.

and I have tried doing the program, but it won't compile and run, and just needed some advanced opinions from experts in the field of programming or people who at least enjoy programming and deal with it on a daily basis.

Also I have problem with including player two, I did write the code for 1 player just rolling the dice, but I can't seem to incorporated player two.

Also I tried linking the graphics "pictures of dice" with the game but it doesn't work?

What do you mean "linking" the graphics?

Is it a console program you're making here? Are you familiar with functions?

EDIT: Also, if you provide samples of your current code it makes it much, much easier to help.
Last edited on
I have to take creative writing which really has no use for me since I want to become an mechanical engineer

The ability to express yourself clearly is something you clearly lack; an engineer who cannot express clearly is, frankly (and I speak as someone who has been in the industry for many years) bloody useless.

I did write the code for 1 player just rolling the dice

Show that code and we'll have somewhere to start.

Also I tried linking the graphics

"linking" is a technical programming term that probably doesn't mean what you meant.
yes we have to make functions but how do i link the functions with the graphics

for example when the random number generator, for player one rolls the dice and gets the number dice 1: 4 and dice 2: 5, how do link the number with the picture so the picture will you and not the number

and how to you pick to be player 1 or 2, is it just normal cout and cin statements?
for example when the random number generator, for player one rolls the dice and gets the number dice 1: 4 and dice 2: 5, how do link the number with the picture so the picture will you and not the number


I think you're asking
when a random number is generated, how can I output a graphical representation of the die?


Here is such a way:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
switch(theRandomNumber)
{
  case 1: cout <<
"***************"  << endl <<
"*             *"<< endl <<
"*             *"<< endl <<
"*      █      *"<< endl <<
"*             *"<< endl <<
"*             *"<< endl <<
"*             *"<< endl <<
"***************"<< endl;
            break;

// and similarly for other cases
}
You probably want a function that you pass in a value to, so it'll print the right side of the dice. Something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
void PrintDice(int side)
{
   switch(side)
   {
      case 1:
         // cout the pattern for 1 here
         break;
      case 2:    
         // cout the pattern for 2 here
         break;
      // Repeat for other sides of dice
   }
}


For example, for side 4, you'd put the cout command that Moschops provided further up the post in the part where I've put the 'cout the pattern' comment.

If you're unfamiliar with how the switch works, it's just comparing the variable (side) to the constants in the case commands (1-6). The part after each case is what's executed if there's a match. Be sure to break out of the switch at each case and also include a default case, outputting something like an error message, which will run if none of your specified cases are hit.


EDIT: Let's call that one a draw, Moschops.
Last edited on
ok I will print my code (by print I mean print it with the printer with large font),

and analyze my mistakes, I may have some syntax error

and then I will copy my program, and see if you guys can check it over, it would really help me out!

since you guys are the experts!

P.S yes writing does help with the job but I don't really care about analyzing poetry, I like reading poems, and even have a couple of favorite poems but don't like writing commentaries about them
Analysis is one of the core points of engineering, isn't it? I'm not saying its fun, but it makes sense that you'd have to be able to do it.
creativity is a big part of engineering, and so is computer science for that matter.

Your goal in engineering is to improve the designs of the past, something you will not be able to do if you can't even let your mind flow in a simple creative writing class.
Last edited on
Pages: 12