random 7 number line generation with percentages
Author |
Message |
NightHawk20009
|
Posted: Fri Aug 06, 2010 1:31 am Post subject: random 7 number line generation with percentages |
|
|
What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
What is the problem you are having?
<
i am trying to write a lotto program to randomly generate lotto numbers in groups of seven now i have not used turing since 99 and am quite rusty if anyone can help with relevant code i have a program template but its just
too primitive and i am also looking to have it generate 300 sets of the numbers. this is a personal see if i can remember half of the language project any help would be appreciated .
this will be based around the rolling dice template>
Describe what you have tried to solve this problem
<Answer Here>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
<Add your code here>
|
Please specify what version of Turing you are using
<Answer Here> |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zren
|
Posted: Fri Aug 06, 2010 5:19 am Post subject: Re: random 7 number line generation with percentages |
|
|
Refresher on arrays, for loops, randomness, and basic math. The record's there because it's powerful when combining with arrays to give results like, oh, roll(37).die3 := 6. Oh and classes for hell of it. More stuff is available at the Turing Walkthrough.
Turing: |
View.Set("text") % So there's a scrollbar for the text generated with put so it doesn't dissapear into the top of the screen.
const Size := 40
for i : 1 .. Size
put Rand.Int (0, 1) .. % .. Means next time continue from the same line
end for
var blarg : array 0 .. Size of int
blarg (3) := 1
put skip, "Avg: ", 3 + 4 + 5 + 6 + 7 / 5
put "Fictional Percentage:", 33/ 44 * 100, "%"
type cat :
record
age : int
legs : int
end record
var c : cat
c.age := 30
c.legs := 3
class Dog
export run, setName
var name : string
proc setName (n : string)
name := n
end setName
proc run
put "Run ", name, " run"
end run
end Dog
var d : ^Dog
new Dog, d
d -> setName ("Fred")
d -> run
|
|
|
|
|
|
|
|
|