I am trying to make a hunger games simulation for the Ti-84 plus CE. My plan was to have the user input names that would be saved. I'm not sure if I should store the names in a list or what. Then random number would determine what happens to each name. I'm not sure what would be the best way to store the names and then store characteristics based on events that happened to their character. Thanks for any advice.
Although you could store the names into a string. Personally, I would convert each inputted name into a separate list. So it doesn't get overwritten by another program. Then when the program gets run, you convert the list back into a string.
You can learn about converting a list to a string and converting the string back to a list on TIBD.
You could just name these lists something like "ʟHGNM1","ʟHGNM2",etc (for Hunger Game NaMe)

As for characteristics, the most straightforward way would be to just make another list for each character. You could name them something like "ʟHGCR1","ʟHGCR2", etc. (for Hunger Game ChaRacteristic).
For something where you have a few names and characteristics, I would store it in a string. You can store multiple names into one string (using the + symbol) and separate the names using the sub( command. You could do something like this:

Code:

//To store
Input "Name: ", Str1
Str1+"/Blue Eyes->Str1

//To recall
Disp "Name", sub(Str1,1,InString(Str1,"/")-1), "Eyes:", sub(Str1,InString(Str1,"/")+1,length(Str1)-InString(Str1,"/
I want each person to be able too to have different traits, i.e. intelligence, strength, speed. Is there a way to have each person input their strength, have it stored as a variable, but be the same variable for each person. That way when it checks to see if a person has a strength of at least three, it is only checking if one variable is greater than 2, not a different variable for each player.

EDIT: I am trying to use matrices to store the data until it needs to be used. I am not entirely sure if I am using the matrices correctly or not, so if you could take a look here to see if it will work. Thanks!
http://sc.cemetech.net/?hash=RJyYQfe4YjIIzSLeNhlv+dK8VCar
Use |LP1 and |LP2 for the player names and |LPSTATS for the statistics. Just use lists.
Is there a way to check how many characters are in a string? I need it to format the names being displayed.
Length(Str1
If you aren't already, I would highly suggest looking at the command index. If you have looked at it... well then use the search bar! Razz
TheLastMillennial wrote:
Length(Str1
If you aren't already, I would highly suggest looking at the command index. If you have looked at it... well then use the search bar! Razz

Thanks. I was not aware of the command index. I will need to check this out.
How do you check the number is a specific cell of a matrix?
To return the value of a cell in a matrix, you use this:

Code:
[A](X,Y)

Where "A" is the matrix, and "X" and "Y" are cell locations.

You can interact with this value in ways such as:

Code:

▪If [A](X,Y)=5
▪[A](X,Y)->A
▪Disp [A](X,Y)
I need help making a more efficient method of storing which people are fighting. Right now, a random number is generated, which stores the names of the people. Then it gets another random number to see if it is a contest of strength, a speed, or an intelligence. Right now, I have to have a separate block of code for each possible combination of people and contest.

Code:

While D>1
   Output(5,11,"Day"
   Output(5,16,N
   Pause
   ClrHome
   randInt(1,4)->E
   randInt(1,4)->F
   While F=E
      randInt(1,4)->F
   End
   If E=1
   Str1->Str5
   If E=2
   Str2->Str5
   If E=3
   Str3->Str5
   If E=4
   Str4->Str5
   If F=1
   Str1->Str6
   If F=2
   Str2->Str6
   If F=3
   Str3->Str6
   If F=4
   Str4->Str6
   Output(5,11,Str5
   Output(6,10,"and
   Output(7,11,Str6
   Output(8,7,"have conflict
   Pause
   randInt(1,3)->R
   If R=1
   Then
      Disp "It is a test of strength
   End
   If R=2
   Then
      Disp "It is a test of speed
   End
   If R=3
   Then
      Disp "It is a test of intelligence
   End
For the name portion, if you store all the names in one string with a special character in-between each, you can use the inString( command to search for that character and then use the sub( command to isolate the name. The inString( command can have a starting value in the string, so the random command would control which name is selected by skipping forward in the string. As for the second part:


Code:
randInt(1,3)->R
Output(1,1,"It is a test of
If R=1
Output(1,17,"strength
If R=2
Output(1,17,"speed
If R=3
Output(1,17,"intelligence
dankcalculatorbro wrote:
For the name portion, if you store all the names in one string with a special character in-between each, you can use the inString( command to search for that character and then use the sub( command to isolate the name. The inString( command can have a starting value in the string, so the random command would control which name is selected by skipping forward in the string. As for the second part:


I tried to read through your steps, which was only difficult due to my lack of knowledge in ti-basic, and this is what I came up with.

Code:

While D>1
   Str1+alpha+Str2+beta+Str3+chi=Str4->Str7
   Output(5,11,"Day"
   Output(5,16,N
   Pause
   ClrHome
   randInt(1,4)->E
   randInt(1,4)->F
   While F=E
      randInt(1,4)->F
   End
   If E=1
   Then
      inString(Str7,Str1->Q
      inString(Str7,alpha->R
      Sub(Str7,Q,R

Is this at all similar to what you recomended? Thanks in advance.
Sorry if this is sorta late in development for suggestions... and for the shameless self-advertising... But I did make a program for storing a list of strings a while back... It is (I believe) in the archives.
  
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