Computer Science Canada Font and random numbers |
Author: | upthescale [ Fri Mar 31, 2006 5:27 pm ] | ||
Post subject: | Font and random numbers | ||
i know how to use font.Draw like make a word bigger and different font and i can also use randint
but how do i put a random number inside the fontdraw, so in thoer words the pogram wud output a number, but in big lettering and whatever font u want? |
Author: | [Gandalf] [ Fri Mar 31, 2006 5:35 pm ] | ||
Post subject: | |||
You would use the + operator to concatenate the random number to the string you are outputting. Before you do this, you must use the intstr function to convert the integer to a string (so that it is able to be concatenated to the output string).
Note: We are using the Rand.Int (min, max : int) : int function instead of randint() in this case, because a function is much more appropriate. |
Author: | do_pete [ Fri Mar 31, 2006 5:38 pm ] |
Post subject: | |
This should be under [Turing Help]. Anyways, all you have to do is make the number and convert it to a string using "intstr". You may also want to use Rand.Int. |
Author: | [Gandalf] [ Fri Mar 31, 2006 5:41 pm ] |
Post subject: | |
You're a bit slow. Yes, this should definately be under [Turing Help]. [Turing Source Code] is for fully functional programs which others can learn from. strint() would convert a string to an integer, check it out for yourself. An easy way to remember this is "__ to __", so in this case "string to int". *edit* I'm not crazy... He had it as strint() before the edit. |
Author: | do_pete [ Fri Mar 31, 2006 5:47 pm ] |
Post subject: | |
Oops! I realized that, then I edited it and you posted that while while I was editing |
Author: | upthescale [ Fri Mar 31, 2006 6:26 pm ] | ||||
Post subject: | |||||
ok i am using
fer a slots game i am making...i am done i am just coding it now ...i need it so if (x) = 3 and (x2) = 3 and (x3) = 3 then the person will win but using
there are no variables so how do i do this? |
Author: | [Gandalf] [ Fri Mar 31, 2006 6:36 pm ] |
Post subject: | |
Replace Rand.Int (1, 15) with your integer variable. |
Author: | upthescale [ Fri Mar 31, 2006 6:37 pm ] |
Post subject: | |
how? |
Author: | [Gandalf] [ Fri Mar 31, 2006 6:42 pm ] | ||
Post subject: | |||
Wow... ugh... Double one word obvious post? Really, this should be self-evident:
|
Author: | upthescale [ Fri Mar 31, 2006 6:45 pm ] |
Post subject: | |
is it possible to make turing, in turing? |
Author: | [Gandalf] [ Fri Mar 31, 2006 6:56 pm ] |
Post subject: | |
Random question? Well... you could recreate many aspects of it, since you would only need to parse the code and call the corresponding Turing functions. To recreate the whole thing would be incredibely useless, and, although it's definately possible (basically anything is with a programming language) why would you want to do it? |