So I want to make this game based on this game

Code:
:ClrDraw
:FnOff
:AxesOff
:0→Xmin
:0→Ymin
:94→Xmax
:62→Ymax
:For(I,4,76,18)
:Line(I,21,I,35)
:Line(I,21,I+14,21)
:Line(I,35,I+14,35)
:Line(I+14,21,I+14,35)
:End
:randInt(1,6,5)→L₁
:0→K
:While K ≠ 45
getkey→K
:For(I,1,5)
:18I-7→X
:If fPart(L₁(I)/2)=.5
:Pt-On(X,28,2)
:If L₁(I)≠1:Then
:Pt-On(X-4,32,2)
:Pt-On(X+4,24,2)
:End
:If L₁(I)>3:Then
:Pt-On(X-4,24,2)
:Pt-On(X+4,32,2)
:End
:If L₁(I)=6:Then
:Pt-On(X-4,28,2)
:Pt-On(X+4,28,2)
:End
:End
:End
:ClrDraw
:AxesOn
:ZStandard
:Output(1,1,"


What I want to do is create a game where the user says how many dices they want and the calc displays them in a triangular number sequence, like this:

28
21 27
15 20 16
10 14 19 25
6 9 13 18
3 5 8 12 17
1 2 4 7 11 16

The whole point of this is allowing the user to choose how many dices they want and this is the way I found to display them.

Problem is, everything.

I calculated the sequences rules for the sequences I wrote above, both vertical and horizontal sequences.
I was thinking about having the lists/sequences calculated and then finding the user input in the lists and save the number of the vertical list it was found in as X and the horizontal list as Y.

I just don't know how to calculate the lists.

Can someone help me write this program, please?
You can ignore the dots on the dices, I just the need to know how to calculate the lists, I think I can figure the rest by my own.

This all looks like… sequences inside of a bigger sequence or something. I don't know. I've been trying to finish this program for months and I'm very confused.

I forgot to say, the value X and Y are so the display goes like this:
Line(18x-14, 18Y-14,18x-14,18Y)
Line(etc…
Welcome to Cemetech, AliceIsDead. Let's talk about the pieces that you need for this one-by-one:
1) You need to generate random dice and display them. Is it correct to say that you don't need help with this part at the moment?
2) You need to display them on the screen. You want to use the lower-triangular arrangement you mapped out in your post, which looks like this:
Code:
28
21 27
15 20 16
10 14 19 25
 6  9 13 18
 3  5  8 12 17
 1  2  4  7 11 16
So far so good? Personally, I think you're better off not bother storing the coordinates to lists, but instead just compute the positions of each die as you go. Are you okay with that solution?
I don't need help with displaying the dices after I have the coordinates. I mean, I know how the Line( command works.

The triangular arrangement I sugested doesn't have a specific size. It all depends on the user input. Say, the user wants 30 dices; the size of the triangular arrangement would change.

It's not a random dice, it's the user input.

I think my problem is the coordinates of the dices. I don't know how to find out the coordinates for the dices so I can display them on the screen with that arrangement.

This is going to sound really n00b but... what does " just compute the positions of each die as you go." mean?

hey thanks for helping Smile
Ignoring the fact that there's still random numbers to display, this will plot a bunch of π's in triangular fashion:


Code:
:For(I,0,5
:For(J,0,I
:Text(6I+10,9J+25,"π
:End
:End

See to it that you know what the components in each argument are doing.
Okay, that's useful... how do I repliace the pi's with dices? Or do that but with Line( instead of Text?
  1. The third argument of Text( can be modified to suit your needs.
  2. The general concept of (multiplier)*(variable)+(offset) for positioning carries over to a bunch of the other DRAW commands.
  3. Toy, practice, investigate. Poke at it to see what does or doesn't break. This is where I'll stand back and observe the progress before chiming in again.
I always find that trying to sketch out what I'm trying to accomplish helps me a lot. Graph paper is really good for that if you have it. I have filled notebooks with sketches of programming problems I was trying to understand. Experiment as much as you can. The nice thing about calculator programming is that there aren't any real penalties for trying something and not having it work the first time. It might be really hard to come up with something that works the way you want it to at first, but that will get easier with practice.
...
You think it would be better for me if I left this project for now and gained more experience on simpler things, and when I'm more experienced try to finish this program?
Keep working on this one. By the end of this you should have a pretty good understanding of how to draw anything you want on the graph screen.
m1ac4 wrote:
Keep working on this one. By the end of this you should have a pretty good understanding of how to draw anything you want on the graph screen.


Alright, I will.

Weregoose wrote:
  1. The third argument of Text( can be modified to suit your needs.
  2. The general concept of (multiplier)*(variable)+(offset) for positioning carries over to a bunch of the other DRAW commands.
  3. Toy, practice, investigate. Poke at it to see what does or doesn't break. This is where I'll stand back and observe the progress before chiming in again.



This is where I'll end up slamming my face against the desk and throw my calc out of the window after the 100th try.

Just kidding, I will do my best. Practice makes it right?


EDIT: Maths is so weird! I followed m1ac4's advice to make some drawings and just realized something... I'll keep on experimenting with this.
Agreed, this project is actually a really good lookout point for the new practices which will become old friends. Assembling your toolkit via this assignment and not an RPG is the best idea I've ever heard.
Weregoose wrote:
Agreed, this project is actually a really good lookout point for the new practices which will become old friends. Assembling your toolkit via this assignment and not an RPG is the best idea I've ever heard.


Oh, thank you I guess Very Happy
This thing sure involves more maths and thinking that it would seem to.
If you're just outputting text, take a look at the Output statement. you can specify X,Y in character size increments and not mess with pixels at all.
I finally did it! Very Happy Finally, after months!

The code below doesn't draw the dices or the dots on the dices, it displays the coordinates of a given number in the triangular arrangement (rown, column)/X,Y. I will do the rest later.

Also, one of my calc's keys jammed and I had to open it up to unjam it, and I did. And I didn't break anything. It's the first time I opened my calc and it all went well except for some keys that got out of place and I put them back wrong, like "On" now reads "No" (it got upside down, but I'm leaving it that way) and the 0 got switched with (-), I'll fix those later. And the memory got erased for some reason. Oh well.

Anyways, here's the code:

Code:
Input A
A->N
seq(B^2/2+0.5B,B,1,N)
If max(Ans=A)
seq(B^2/2+0.5B,B,1,N)->L3
seq(C+1,C,0,N)->L1
seq(D^2/2-0.5D,D,1,N)->L2
For(E,1,N)
seq(F^2/2+(L1(E)+.5)*F+L2(E),F,1,N)
If max(Ans=A)
Ans->L3
End
For(G,1,dim(Ans))
L3(G)=A
If Ans
G->Y
End
seq(H^2/2-H/2+1,H,1,N)
If max(Ans=A)
seq(H^2/2-H/2+1,H,1,N)->L4
seq(I,I,-1,N)->L5
seq(J^2/2-.5J+1,J,1,N)->L6
For(K,1,N)
seq(L^2/2+(L5(K)+.5)*L+L6(K),L,1,N)
If max (Ans=A)
Ans->L4
End
For(M,1,dim(Ans))
L4(M)=A
If Ans
M->X
End
Disp X,Y


Drawing and writing the steps of the program really helped me, in fact, I think that was what really solved the problem and made things less confuse, so thank you m1ac4.

And thank everyone else for the support. A bit of encouragement always helps Smile


EDIT: Ok, I have another problem. Changing the code to display the dices on the Graph Screen, it goes like this:


Code:
Input A
A->N
For(A,A,1,-1)
seq(B^2/2+0.5B,B,1,N)
If max(Ans=A)
seq(B^2/2+0.5B,B,1,N)->L3
seq(C+1,C,0,N)->L1
seq(D^2/2-0.5D,D,1,N)->L2
For(E,1,N)
seq(F^2/2+(L1(E)+.5)*F+L2(E),F,1,N)
If max(Ans=A)
Ans->L3
End
For(G,1,dim(Ans))
L3(G)=A
If Ans
G->Y
End
seq(H^2/2-H/2+1,H,1,N)
If max(Ans=A)
seq(H^2/2-H/2+1,H,1,N)->L4
seq(I,I,-1,N)->L5
seq(J^2/2-.5J+1,J,1,N)->L6
For(K,1,N)
seq(L^2/2+(L5(K)+.5)*L+L6(K),L,1,N)
If max (Ans=A)
Ans->L4
End
For(M,1,dim(Ans))
L4(M)=A
If Ans
M->X
End
Line(18X-14, 18Y-14,18X-14,18Y
Line(18X-14,18Y,18X,18Y
Line(18X,18Y-14,18X,18Y
Line(18X-14,18Y-14,18X,18Y-14
End


Problem is, on the first square/dice drawn on the Graph Screen (A), only the left side is drawn. All the other squares go just fine. Why does this happen?

EDIT: I fixed it! Aparently I just had to use ZSquare... go figure. Anyways, it's done. Now I just need the random dots and the prog is finished Very Happy
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement