11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

WHATGOES INSIDE THE ( ) ?Numbers:10 LET X=lNT(34.7)Variables:10LETX=INT(J)Expressions:10 LET X=l NT(3*Y+2)Functions:10 LET X=INT(RND(8J)<strong>Here</strong> is how to save a lot of room.Instead of30 LET R=RND(8}50 LET S=R*660 LET I=INT(S)70LETD=1+IUse just70 LET D=1+INTfRND(8)*6)RANDOM NUMBERS IN THE MIDDLESuppose your game needs random numbers between 6 and 8. You have a funny die whichshows only 6, 7 or 8 when you roll it.Run this:10 LET D=INT(RND(8]*3J+6How it works:expressionmakes numbers likesmalllargeRND(8)RND(8)*3INT(RND(8)*3)INT(RND(8)*3)+60.010.0306and 0.992.9728Assignment 13:1. Write a program which "rolls" two dice, called Dl and D2. Show the number on Dland on D2 and the sum of the dice. You do not need the variables R, S and I in theprogram above. They were used to show how the final answer was found.2. Write a program which shows the roll of a special die. It is a cube (six sides) and thesides have the numbers 10,12,14,16,18 and 20 on them.3. Write a "paper, scissors and rock" game, you against the computer. (Paper wrapsrock, rock breaks scissors, scissors cut paper). The computer chooses a number 1, 2 or3 using the RND() function: 1 is paper, 2 is rock, 3 is scissors. You INPUT your choiceas P, R or S and the computer figures out who won and keeps score.78

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!