Results 1 to 4 of 4

Thread: College help

  1. #1
    Join Date
    Jul 2014

    Post College help

    Hello guys!
    So i need to do this two problems for the college and im really, REALLY lost, i need some kind of help , for the moment teacher let us use Dreamweaver, so here are the problems:
    1)Make a game that simulates the game "the one".
    Function of the game:
    Each turn, each player drops a dice several times and keep adding points until one of this two things happen: the player decides to stop dropping the dice and keeps the score achieved or dice hits 1 and the player loose his turn.
    The player that gets 50 points first wins.

    2)Make a program that simulates the game "guess the code".
    Function of the game:
    The program generates a code of four colours that the user must guess, for example: the code might be blue-green-blue-red, en each try the user will try to guess what is the composition and the position of the colours, for example if the code is red-red-green-blue and the user guess yellow-red-red-green the program must answer three right colours and one good position, the user have 10 attempts to win.
    Sorry for my bad english and thank you.

  2. #2
    Join Date
    Oct 2012
    I'm not sure if anyone is going to help you on this one before we can see some of the attempts you have made.

  3. #3
    Join Date
    Mar 2007
    Ok, will call it like I see it...

    Either you are looking for someone to code for you and this is not a homework project and I say that because both are a little too complex for a beginner or you are in class assing around and not paying attention.

    With "the one" game and the "code" game, I assisted with an answer to some partial code that was part both.

    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  4. #4
    Join Date
    Mar 2012
    I'm not going to do the exercise for you (I don't write much JS anyway) but I will help you get started on the first one.

    Firstly, as with any programming job, you need to analyse and document what functionality the program needs to have. You need this to be able to do the job, but it also acts as a design spec. which (in a real-life scenario) you would get agreed before you touched any code. That is unless you are given a detailed design spec. So what functionality is needed?

    1. The ability to generate pseudo-random integers in the range 1 to 6, all of which are equally likely to arise.


    a) I say "pseudo-random" because you require specialist hardware to generate true random numbers.

    b) The requirement that all the integers are equally likely is not as simple as it may seem. E.g. If you:

    - Generate a floating point number between 0 and, say, 0.999999.
    - Multiply it by 5.
    - Round it to the nearest integer (i.e. 0.499995 rounds to 0 and 0.500000 rounds to 1)
    - Add 1.

    You will generate integers between 1 and 6, but they will not be equally likely to arise. I'll let you work out why, and how to avoid it.

    2. The ability to record and display the cumulative scores for a specific number of players E.g. Upto 6.

    3. The ability to record the number of players, and, optionally, their IDs.

    4. The ability to record and display who is the current player.

    5. The ability to record and display the interim score of the current player during a turn.

    6. The ability to accept a play or terminate choice by the current player.

    a) If they chose to terminate:
    - Their cumulative score is updated to match the interim score.
    - The current player is incremented.

    b) If a 1 is thrown:
    - The interim score is discarded.
    - The current player is incremented.

    c) Otherwise the number thrown is added to the interim score.
    - If the interim score reaches 50, the current player is shown to be the winner. The game ends.
    - Otherwise the go continues.

    Now all you have to do is turn that logic into code!
    Last edited by jedaisoul; 07-13-2014 at 09:45 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles