Puzzler 2.3 Copyright (C) 1997 H†kon Stordahl E-mail : stordahl@usa.net Homepage: http://stordahl.home.ml.org/ Date : 09.06.97 Model : CASIO CFX-9850G Calculator Notes -------------------------------------------------------------------------------- This is a simple game, which purpose is to arrange the digts in increasing order, i.e: 123 456 78 You move the different digts by using the arrow keys on your calculator. At any time in the game you may want to quit, by pressing the [EXIT] key. You will then get a question whether to play again or not. Answer by pressing Y ([-]) or N ([8]). To enable the high score list you have to uncomment line 150 in the program listing by removing the apostrophe. In addition you have to execute the following line in RUN-mode: Seq(999,I,1,20,1)->List 2 Symbol: Description: Key(s): -------------------------------------------------------------------------------- -> Assginment operator Above [AC/ON] * Multiplication Below [DEL] / Division Below [AC/ON] (-) Unary minus Below [+] = Equal to [SHIFT] [.] <> Not equal to [SHIFT] [VARS] [F6] [F3] [F2] >= Greater than or equal to [SHIFT] [VARS] [F6] [F3] [F5] <= Less than or equal to [SHIFT] [VARS] [F6] [F3] [F6] => If-Then [SHIFT] [VARS] [F3] [F3] \sqrt Square root [SHIFT] [X^2] \slash / (slash) [F6] [F5] \{i} \sqrt(-1) [OPTN] [F3] [F1] Frac Returns fractional part of argument [OPTN] [F6] [F4] [F3] ClrText Clear the text screen [SHIFT] [VARS] [F6] [F1] [F1] Getkey Determine keypress [SHIFT] [VARS] [F6] [F4] [F2] Locate Display variable at the given coords [SHIFT] [VARS] [F6] [F4] [F1] { Left brace [SHIFT] [*] } Right brace [SHIFT] [/] [ Left bracket [SHIFT] [+] ] Right bracket [SHIFT] [-] List List-variable [OPTN] [F1] [F1] Sum The sum of all entries in the list [OPTN] [F1] [F6] [F6] [F1] And Logical And operator [OPTN] [F6] [F6] [F4] [F1] Or Logical Or operator [OPTN] [F6] [F6] [F4] [F2] Not Logical Not operator [OPTN] [F6] [F6] [F4] [F3] File name: PUZZLER Variables: C, I, J, K, L, O, W, X, Y, List 1 -------------------------------------------------------------------------------- Do ClrText "Puzzler 2.3" "(C) Hakon Stordahl" {2,4,9,1,5,8,3,7,6}->List 1 3->I 1->J For 1->K To 100 Int (4Ran#)->L If L=0 And J<3 Then List 1[3*(J+1)+I-3]->List 1[3J+I-3] J+1->J IfEnd If L=1 And J>1 Then List 1[3*(J-1)+I-3]->List 1[3J+I-3] J-1->J IfEnd If L=2 And I<3 Then List 1[3J+I+1-3]->List 1[3J+I-3] I+1->I IfEnd If L=3 And I>1 Then List 1[3J+I-1-3]->List 1[3J+I-3] I-1->I IfEnd 9->List 1[3J+I-3] Next For 1->I To 3 For 1->J To 3 If List 1[3J+I-3]<>9 Then Locate 9+I,3+J,List 1[3J+I-3] Else Locate 9+I,3+J," " I->X J->Y IfEnd Next Next Locate 1,7,"Move: " Locate 18,7,"Exit" 0->O 0->W Do Getkey->C Locate 7,7,O If C=28 And Y<3 Then Locate 9+X,3+Y,List 1[3*(Y+1)+X-3] List 1[3*(Y+1)+X-3]->List 1[3Y+X-3] Y+1->Y Locate 9+X,3+Y," " 9->List 1[3Y+X-3] O+1->O IfEnd If C=37 And Y>1 Then Locate 9+X,3+Y,List 1[3*(Y-1)+X-3] List 1[3*(Y-1)+X-3]->List 1[3Y+X-3] Y-1->Y Locate 9+X,3+Y," " 9->List 1[3Y+X-3] O+1->O IfEnd If C=38 And X<3 Then Locate 9+X,3+Y,List 1[3Y+X+1-3] List 1[3Y+X+1-3]->List 1[3Y+X-3] X+1->X Locate 9+X,3+Y," " 9->List 1[3Y+X-3] O+1->O IfEnd If C=27 And X>1 Then Locate 9+X,3+Y,List 1[3Y+X-1-3] List 1[3Y+X-1-3]->List 1[3Y+X-3] X-1->X Locate 9+X,3+Y," " 9->List 1[3Y+X-3] O+1->O IfEnd (Sum (List 1={1,2,3,4,5,6,7,8,9})/9)=1->W LpWhile (Not W) And (C<>47) ClrText If W Then If O<20 Then "Excellent!" IfEnd If O<40 And O>=20 Then "Good" IfEnd If O<60 And O>=40 Then "OK" IfEnd If O>=60 Then "Too bad" IfEnd IfEnd Not W=>99999->O 'Uncomment following line to enable high score 'Prog "HISCORE" Locate 1,7,"Play again? (Y\slashN)" Do Getkey->C LpWhile C<>32 And C<>64 LpWhile C=32 ClrText -------------------------------------------------------------------------------- File name: HISCORE (optional) Input : O Variables: A, B, C, E, G, U, V, List 2 -------------------------------------------------------------------------------- If OList 2[17] ClrText Locate 5,1,"A new record" Locate 2,2,"Enter your initials" 9->A 4->B Locate A,B,"[" Locate A+4,B,"]" Do 1->E 1->C A+1->A Do Prog "WRITECH" Do Getkey->G LpWhile G<>38 And G<>27 And G<>28 And G<>37 If G=28 Then E-1->E E=0=>27->E IfEnd If G=37 Then E+1->E E=28=>1->E IfEnd E->C E=27=>29->C E=25=>27->C E=26=>28->C LpWhile G<>27 C->List 2[A+8] LpWhile A<12 Do 0->V For 1->U To 13 Step 4 If List 2[U]>List 2[U+4] Then 1->V List 2[U]->A List 2[U+1]->B List 2[U+2]->C List 2[U+3]->D List 2[U+4]->List 2[U] List 2[U+5]->List 2[U+1] List 2[U+6]->List 2[U+2] List 2[U+7]->List 2[U+3] A->List 2[U+4] B->List 2[U+5] C->List 2[U+6] D->List 2[U+7] IfEnd Next LpWhile V IfEnd ClrText Locate 6,1,"High scores" For 0->U To 4 For 1->A To 3 List 2[4U+1+A]->C U+2->B Prog "WRITECH" Next Locate 19,B,List 2[4U+1] Next -------------------------------------------------------------------------------- File name: WRITECH (optional) Input : A, B, C Variables: None -------------------------------------------------------------------------------- C=76 Or C=1=>Locate A,B,"A" C=66 Or C=2=>Locate A,B,"B" C=56 Or C=3=>Locate A,B,"C" C=46 Or C=4=>Locate A,B,"D" C=36 Or C=5=>Locate A,B,"E" C=26 Or C=6=>Locate A,B,"F" C=75 Or C=7=>Locate A,B,"G" C=65 Or C=8=>Locate A,B,"H" C=55 Or C=9=>Locate A,B,"I" C=45 Or C=10=>Locate A,B,"J" C=35 Or C=11=>Locate A,B,"K" C=25 Or C=12=>Locate A,B,"L" C=74 Or C=13=>Locate A,B,"M" C=64 Or C=14=>Locate A,B,"N" C=54 Or C=15=>Locate A,B,"O" C=73 Or C=16=>Locate A,B,"P" C=63 Or C=17=>Locate A,B,"Q" C=53 Or C=18=>Locate A,B,"R" C=43 Or C=19=>Locate A,B,"S" C=33 Or C=20=>Locate A,B,"T" C=72 Or C=21=>Locate A,B,"U" C=62 Or C=22=>Locate A,B,"V" C=52 Or C=23=>Locate A,B,"W" C=42 Or C=24=>Locate A,B,"X" C=32 Or C=27=>Locate A,B,"Y" C=71 Or C=28=>Locate A,B,"Z" C=61 Or C=29=>Locate A,B," " --------------------------------------------------------------------------------