I'm trying to make a very simple board game for the TI-84+ CE!
I don't have a project name yet, but maybe something like BoardsCE or BoardgameCE.

Because I'm not really good with programming the way I am making this is with very much code.
I am sure there are ways to write it out with less code, but that's not how I now make it.
But any recommendations for better code with the same effect are appreciated!

I am making it in basic, so it doesn't look professional, but maybe I'll still give the square's a backgroundcolor, however, that is then more code, so more needed room.

And maybe I'll make a version of the game in C, if the ti-basic version is ready. But I don't know that yet, maybe I just only make this basic version.
Depends on how much I have learned by then in C, because at the moment I can't program in C.

I'll add here some pictures of the board of the game, which is already in its first state, and some views at the code and a picture of one of my notes.











Let me know when you have the code uploaded!
I've the code ready for how it is now.

I still want to make something that you can see the circle that is the player moving, but I don't know if and how that is possible.
And I am considering if I should make colored squares... I don't know what looks better.

But, the code is really huge, it is more than 400 lines of code.

I've here a link to the file.
But I don't know how I can share it better, without needing to set it in my drive. (I don't want that everyone knows my real name...)
So for now I work with this link, but it can only be opened 10 times, and is only valid seven days...
Privacy_Dragon wrote:
I've the code ready for how it is now.

I still want to make something that you can see the circle that is the player moving, but I don't know if and how that is possible.
And I am considering if I should make colored squares... I don't know what looks better.

But, the code is really huge, it is more than 400 lines of code.

I've here a link to the file.
But I don't know how I can share it better, without needing to set it in my drive. (I don't want that everyone knows my real name...)
So for now I work with this link, but it can only be opened 10 times, and is only valid seven days...

An easy way to share code, especially short BASIC programs like that, is to just copy if from TI Connect CE and paste it into a code block like this:

Code:
ClrHome
While 1
Disp "This is a program.
End
Isn't more than 400 lines of code a bit much to set it in a code block that way?

But I've found out that I can also share it via SourceCoder3.
http://sc.cemetech.net/?hash=oC9E5ZSH3Bln0dWzOrlAWOm2y7wF
SAX wrote:
12:23:05 AM [Sam] I'm gonna post an example in your topic so you see what I mean
12:22:45 AM [Privacy_Dragon] OK, will have a look at that.
12:22:38 AM [Sam] For instance, you could use a For loop to draw a line, but each time it runs the loop it draws that same line a certain number of pixels to the right
12:22:04 AM [Sam] For drawing functions, For loops are extremely useful for drawing many similar items at once
12:21:58 AM [LogicalJoe] Apologies if this is a bit overwhelming.
12:20:54 AM [#] [D] [LogicalJoe] You can find all the documentation you need on that website.
12:20:54 AM [Sam] Using for loops, you can condense your hundred or so Text and Line lines to just a couple loops
12:20:33 AM [#] [D] [LogicalJoe] [http://tibasicdev.wikidot.com/for]
12:20:08 AM [Privacy_Dragon] Yes, but I don't know how to use them and for what situations to use them
12:19:33 AM [#] [D] [LogicalJoe] Negatives are indicated with tilda, not dash.
12:19:22 AM [Sam] Privacy_Dragon, have you ever heard of For( loops?


Continuing from SAX, your massive block of Text( and Line( commands are a perfect place to use For( loops. If you want to learn the syntax for For, use the link in the SAX quote above. For example, I can condense this

Code:
Line(-75,50,75,50,RED)
Line(-75,-50,-75,-50,RED)
Line(75,50,75,-50,RED)
Line(75,-50,-75,-50,RED)
Line(-75,30,75,30)
Line(-75,10,75,10)
Line(-75,-10,75,-10)
Line(-75,-30,75,-30)
Line(-50,50,-50,-50)
Line(-25,50,-25,-50)
Line(0,50,0,-50)
Line(25,50,25,-50)
Line(50,50,50,-50)
Line(-75,30,50,30,RED)
Line(-50,10,75,10,RED)
Line(-75,-10,50,-10,RED)
Line(-50,-30,75,-30,RED)

To this

Code:
For(A,~50,50,25
Line(A,~50,A,50
End
For(A,~50,50,20
Line(~75,A,75,A,RED
End
0->B             //In this program, I'm just using B as an oscillator to make the blue line switch sides every time the For( loop runs. You can replace B and A with whatever vars you want if they're already in use in your program.
For(A,~30,30,20
Line((2B-1)75,A,(2B-1)50,A
not(B->B
End
Line(~75,~50,~75,50,RED
Line(75,~50,75,50,RED

This might not seem like that large a change in program size, but it's actually much better than it looks, since the code with the For( loops is much more scalable. If you wanted your grid twice as dense, for example, your original code would be at least twice as long. With the For( loops, the code doesn't grow at all. Here's what that same code would look like to create a grid twice as dense:

Code:
For(A,~62.5,62.5,12.5
Line(A,~50,A,50
End
For(A,~50,50,10
Line(~75,A,75,A,RED
End
0->B
For(A,~40,40,10
Line((2B-1)75,A,(2B-1)62.5,A
not(B->B
End
Line(~75,~50,~75,50,RED
Line(75,~50,75,50,RED


please do not make unsolicited optimizations to my code. I'm trying to demonstrate a coding principle, not flex on a newbie. yes, I'm sure the **** I did with B can be smaller and faster
So, if I want to add that you see the circle (player) move I should use something like:


Code:

for(Q,y-current,y-new,5)
Circle(Q,B,2)
Circle(Q,B,2,WHITE)
End
//then draw again the board
Privacy_Dragon wrote:
So, if I want to add that you see the circle (player) move I should use something like:


Code:

for(Q,y-current,y-new,5)
Circle(Q,B,2)
Circle(Q,B,2,WHITE)
End
//then draw again the board


Yep, that will do it! You will have to keep in mind the weird stuff that happens when you "move" an object using a for loop like that, though, since your loop actually ends without any circle onscreen. You'll want to draw the character in its final position last.
I've a question about your notation.
Why do you use ~50 instead of -50?
Does -50 give an error or is it only translated to the calculation '-'?
In SourceCoder, ~ means the negation sign (next to the .) while - means the subtraction operator.
Both 10 ~ 3 and (-3) will give an error if you don't manually change the negation sign to subtraction or vice versa.
Using ~ makes it easy for people to run your code without having to type it out for themselves, which means people are more likely to give help.
Ah, thanks, that makes sense.
Then I'll change that everywhere in my code.
I have already changed the A=... to ...->A
Then I still have to think of something that the moving circle follows the path...
I need to think much on that..

Code:

Lbl C
For(Q,Y,B,5)
   Circle(Q,B,2)
   Circle(Q,B,2,WHITE)
End
Goto R

Lbl E
For(Q,Y,C,5)
   Circle(Q,C,2)
   Circle(Q,C,2,WHITE)
End
Goto R


This code could be optimized to just one label.


Code:

Lbl C
For(Q,Y,Ans,5)
   Circle(Q,Ans,2)
   Circle(Q,B,Ans,WHITE)
End
Goto R


Now all you have to do is place the variable name before you call this subroutine. Smile
So you mean that I set in the last line of label A: B?

But I still have to find something that the circle will follow the correct path, so that it doesn't go straight to the new point, but that it follows the correct order on the board.
So that it goes not from 1 diagonal to 7, but from 1 horizantal to 6 and then vertical to 7.

But I don't know how to do that yet.
Privacy_Dragon wrote:
So you mean that I set in the last line of label A: B?

But I still have to find something that the circle will follow the correct path, so that it doesn't go straight to the new point, but that it follows the correct order on the board.
So that it goes not from 1 diagonal to 7, but from 1 horizantal to 6 and then vertical to 7.

But I don't know how to do that yet.


Ah okay. So in that case you would a make a movement simulator. I can you make chart on how the character is supposed to move. I'm not really understanding your english.
Here a picture of what I mean.
I've now managed to make the circle move in the right direction (I hope).
But I can't test it yet, because I still don't have options to send programs to my calculator.
But I think it will work correctly now, if the circle's don't move in the right direction I might have to change some little things, maybe I have put some variables in the wrong order, but I think it's good now.

The bad thing of the code I use to make the circle move in the right order is that the whole program is now almost 600 lines of code....
Privacy_Dragon wrote:
I've now managed to make the circle move in the right direction (I hope).
But I can't test it yet, because I still don't have options to send programs to my calculator.
But I think it will work correctly now, if the circle's don't move in the right direction I might have to change some little things, maybe I have put some variables in the wrong order, but I think it's good now.

The bad thing of the code I use to make the circle move in the right order is that the whole program is now almost 600 lines of code....


https://tiplanet.org/pb/

You can upload a ROM for the CEmu online if you can find one or someone can dump one for you.
Can anyone help me with solving this problem?


First when there is thrown a number, one of the circles should move.
Now, however, one of the circles goes to a point where it shouldn't be, and the other moves.
But then the next throw, you should see the other circle move (player 2), but that isn't what happens. The same circle moves always.

I still have to change the red lines, but that should be easy done
Privacy_Dragon wrote:

First when there is thrown a number, one of the circles should move.
Now, however, one of the circles goes to a point where it shouldn't be, and the other moves.
But then the next throw, you should see the other circle move (player 2), but that isn't what happens. The same circle moves always.


Can you paste a snippet of the routine for the circle movement?
Well, I have removed now the code for moving the Circle, so that you only see that it is on a new spot.


Code:
Circle(A,B,2)
Circle(C,E,2)



Code:
Lbl A
Pause
randInt(1,6)->D
T+D->T
B->Y
A->X
If T=1
Then
   ~58.5->A
   42.5->B
End
If T=2
Then
   Disp "YOU FLY ON A DRAGON TO 11"
   ~32->A
   23->B
End



Code:
Lbl B
Pause
randInt(1,6)->D
S+D->S
C->X
E->Y
If S=1
Then
   ~58->C
   36->E
End
If S=2
Then
   Disp "YOU FLY ON A DRAGON TO 11"
   ~37.5->C
   16->E
End


But I think the problem of which circle moves is somewhere here:


Code:
N+1->N
If remainder(N,1)
Then
   Goto A
Else
   Goto B
End
  
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 2
» All times are GMT - 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