Hello. I was wondering if someone can help me out with this program. I am currently running into issues with my variation of Memory. The issue is when all the pairs are completed and I need the code to register that all of the pairs are gone and as a result, the player has won the game. This part is mentioned in the code. The other issue is that I can't seem to randomize the variables for each card (i.e. instead of card two being just b, make it random between a,b,c,d without that variable being picked for other cards
This is on a TI-92, so the code is quite a bit different. I did one with two pairs to start in order to be able to efficiently duplicate the code later.
The code is displayed below. Feel free to optimize the code and give suggestions on how to improve and well as solutions to the problems presented.
Also, feel free to use and distribute the code. I, however, am not responsible for malicious use of this code or for any other inappropriate purposes this code may be used for.

Code:
: htpmem1()
: Local a,b,c,d
: rand(10)-->a
: a-->c
: c=a
: rand(10)-->b
: b-->d
: b=d
: Lbl p
: Loop
: Input "Select first card", e
: If e=1 then
: Disp "Card one",a
: EndIf
: If e=2 then
: Disp "Card two",b
: EndIf
: If e=3 then
: Disp "Card three,c
: EndIf
: If e=4 then
: Disp "Card four", d
: EndIf
: Input "Second Card",f
: If f=1 then
: Disp "Card one",a
: EndIf
: If f=2 then
: Disp "Card two",b
: EndIf
: If f=3 then
: Disp "Card three,c
: EndIf
: If f=4 then
: Disp "Card four", d
: EndIf
: Input "Did you find a match?",h
: If h=c or h=a then
: DelVar a
: DelVar c
: EndIf
: If h=b or h=d Then
: Delvar b
: Delvar d
: Goto q (://Issue with cards, as have to be in specific order and cannot use variable recall because
 variables do not exist)
: EndIf
: EndLoop
: Lbl q
: Input "play again?",i
: If i=0 then
: Goto p
: EndIf
: If i=1 Then
: Disp "Thanks for playing!"
: EndIf
: EndPrgm
  
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