Results 1 to 4 of 4

Thread: Simple math game

  1. #1
    Join Date
    Jul 2012
    Beans
    3

    Simple math game

    Hi all,

    I have a problem, its like this. I want to make a shell script.
    So basically the computer must give the user a math question like 3*8 and the user enter the right number if not it will get a warning like wrong answer, and to escape the game u must press x.


    I tried with while loop but i get stuck everytime, and i have also a problem with the $RANDOM function. I tryed to use $Random and than save it in a varible the problem is it gives me everytime the same question. Its really frustrating.

    Can someone please help, thank you very much.

  2. #2
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: Simple math game

    We can't help unless you post your code for us to look at.
    Cheesemill

  3. #3
    Join Date
    Jul 2012
    Beans
    3

    Re: Simple math game

    I couldt finish it

    while true {

    do
    a=$(($RANDOM))
    b=$(($RANDOM))
    c=$a*b

    done

    }


    I dint complete it because so far it just give me the same numbers

  4. #4
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Simple math game

    Sounds like homework.

    From the code of conduct that you agreed to when you created your account:

    While we are happy to serve as a resource for hints and for asking questions when you get stuck and need a little help, the Ubuntu Forums is not a homework service. Please do not post your homework assignments expecting someone else to do it for you. Any such threads will be taken offline and warnings or infractions may be issued.

    You doesn't seem to understand the most basic shell scripting concepts. Please check out the links from my signature.

    Thread closed.

Tags for this Thread

Bookmarks

Posting Permissions

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