December 27, 2006
Die Rolling Program
I finished my first complex NXT programming project tonight. I wrote it with NXT-G -- the programming environment that comes with the NXT.
It rolls a die randomly, and draws it on the screen, as you can (sort of) see in the picture to the right.
The main program ("Draw Die Test") just chooses a random number from 1 to 6, and then calls a "My Block" called "Draw Die" to (drumroll, please) draw the die. This is the most complex code because there are seven different "spot" position that make up the various die drawings. I actually pretend like there are nine, not seven, so I can do computations assuming a three-by-three grid, numbered from zero to eight. Spots one and seven are never used.
Not quite as complicated, but still using a number of math functions is the "Draw Die Spot" block. It draws just one little circle, in one of the nine positions.
Finally, there is no built-in modulo division function (% to C-language programmers), so I had tosteal write a block for that. It's called "Mod".
You can dowload the program here. If you have any questions, please post a comment.
Update: As of 1/8/08, the folder is still not public on BrickShelf.
You can download the four necessary programs here, here, here and here!
It rolls a die randomly, and draws it on the screen, as you can (sort of) see in the picture to the right.
The main program ("Draw Die Test") just chooses a random number from 1 to 6, and then calls a "My Block" called "Draw Die" to (drumroll, please) draw the die. This is the most complex code because there are seven different "spot" position that make up the various die drawings. I actually pretend like there are nine, not seven, so I can do computations assuming a three-by-three grid, numbered from zero to eight. Spots one and seven are never used.
Not quite as complicated, but still using a number of math functions is the "Draw Die Spot" block. It draws just one little circle, in one of the nine positions.
Finally, there is no built-in modulo division function (% to C-language programmers), so I had to
You can dowload the program here. If you have any questions, please post a comment.
Update: As of 1/8/08, the folder is still not public on BrickShelf.
You can download the four necessary programs here, here, here and here!
Comments:
<< Home
Oops! I'll put the My Blocks up there too. Didn't think I had to do that. Can you run it without those, but just not view the My Blocks?
Please contact me by e-mail - see my contact info up in the same place...
Please contact me by e-mail - see my contact info up in the same place...
I can't run your program, only I can view the main program.
I don't know where is your e-mail.
I can't see your profile.
I think your profile is not available.
I don't know where is your e-mail.
I can't see your profile.
I think your profile is not available.
My contact info will be up at the same place as the program when they make the folder public.
Check your youtube inbox...
Post a Comment
Check your youtube inbox...
<< Home