Need help psuedocoding a dice game and dont know where to even start closed Ask Question. Viewed 4k times 1. I am a beginner IT student and doing a project for my programming logic and design class. I need to create a psuedocode for a dice game that allows you 2 rolls with 5 dice. On the first roll you get to pick 1 die to keep.
The development and testing of knowledge based computer tools for the integration and coordination of various phases and participants of the engineering process are described. A system architecture - DICE - is presented which is intended to provide cooperation and coordination among multiple designers working in separate engineering disciplines, using knowledge to estimate interface conditions between disciplines, recording who used any piece of design data created by others, and how such data was used, and checking for conflicts among disciplines, manufacturability, and manufacturing cost and schedule impacts of design decisions. The system is being developed using object oriented programming and blackboard control techniques.
Current status of DICE, along with examples in the domain of civil engineering are presented.
I am a beginner IT student and doing a project for my programming logic and design class. I need to create a psuedocode for a dice game that allows you 2 rolls with 5 dice.
On the first roll you get to pick 1 die to keep. The computer then rolls the other 4 dice and calculates you're score based on what you rolled. There are 3 rolls per game and the total score is displayed. Rolling nothing takes points away. The scoring is: 2 of a kind=50 points, 3 of a kind=75 points, 4 of a kind=100 points and nothing subtracts 50 points.The whole problem I have is I dont even know where to start.
I think I need this to repeat 3 times, but what variables do set? Please someone help me, I cant really ask my instructor because he is outside smoking the whole class and everything I have learned about this class mostly came from the internet and reading the book. I dont want to fail this class.someone please help me through this??? First of all don't panic.
What you are about to do is break the task down into small steps.Pseudo-code is not really code - you can't use it directly as a language, but instead it is just plain english to describe what it is you are doing and the flow of events.So what are the initial steps to get you started?Ask yourself what are the facts, what do you know exist in advance. These are the 'declarations' that you make.You have five dice. Each is a seperate object so each gets it's own variable declaration dice1dice2dice3dice4dice5Next decide if each die has an initial value dice1 initial value = 0etc.Next you know that you have to throw the dice a number of times. Throwing is a variable with an initial value turns initial value = 2turnscounter initial value = 2You should be getting the idea now. Are there other things you should declare in advance? I think so!Next you have to decide what it is you are doing step by step. Is it just a sequence of events or is it repeating?
If it's repeating how do you get it to stop? While turnscounter is less than 2Repeat the following: turnscounter = turnscounter + 1if turnscounter = 2Throw. Removeadice.endif.perhaps you have to tell the reusable code which objects they are going to be working with? These are parameters that you pass to the reusable code Throw(dice1) perhaps also you need to update some variables that you created? Do it in the reusable code with or without passing them as parameters.This is by no means complete or perfect, but you should get the idea about what's going on and how to break it down. It could take quite a while to do. You have already almost answered the question by simply writing it down here.
There is no strict definition of what pseudocode is. Why don't you start by re-writing what you've described here as a sequence of steps. Then, for each step simply refine that step further until you think you've made it as fine-grain as you like.You could start with something like this: Roll 5 dice.Pick 1 die to keep.Rolls the other 4 diceCalculate the score.// etc.Quite weird to think that it's easier to ask SO than your instructor!:).
The easiest way to get started on this is to not rigorously bind yourself to the constraint of a specific language, or even to pseudocode. Simply, in natural English, write out how you would do this. Imagine that YOU are the computer, and somebody wants to play the game with you.
Just imagine, in very specific detail, what you would do at each potential step, i.e. Give the user 5 dice.
Ask the user to roll them. From that roll, allow the user to pick one die to keep.etc. Once you have done this, and you are sure it is correct, start transforming it into pseudo code by thinking about what a computer would need to do to solve this problem. For instance, you'll need a variable keeping track of how many points the user as, as well as how many total rolls have occurred. If you were very specific in your English description of the problem, this should mean you basically only need to plug pseudo code into a few sentences you already have - in other words, you're just substituting one type of pseudo code for another.I'd like to help, but straight-up providing the pseudo code wouldn't be very helpful to you.
One of the hardest steps in beginning programming is learning to break a problem down into its constituent elements. That type of granular thinking is unintuitive at first, but gets easier the more time you spend on it. Well, pseudo-code, in my experience, is best drawn up when you pretend you're writing up the work for someone else to do: THINGS WE NEED. Dice. Players.
ScoreTHINGS WE TRACK. Dice rolls. Player scoreTHINGS WE KNOW(These are also called constants).
Nothing (-50). 2 of a kind (+50). 3 of a kind (+75). 4 of a kind (+100)All of these are vital tools to getting started. And.well, asking questions on stackoverflow.Next, define your 'actions' (things we do), which utilizes the above known things that we will need.I would start the same place I always do: creating our things.