Snake v1.0 (c) Hidetake Jo 1996 -------------------------------------------------------------- Note: there was a bug in version 0.7 which prevented the snake from moving sideways...the bug is fixed in this version 0.9 Note: there was a minor bug in 0.9 It is now fixed in this version. this is the final release for snake.. -------------------------------------------------------------- Just a simple game, ported from QBasics with lots of optimization...however it is still pretty slow. Game inspired by a Qbasics program sent in by Manners. Now has highscore store and display function in version 0.7 For the Snake to operate properly you will need to have atleast 430 bytes or free ram on your calculator. This version of snakes does have accurate sprite collision detection, effcient coordinate store algorythm (eats up little speed), and will PRINT your score. and compare it against the highscore to check if you earned a highscore. :-) Please note though that the enemy snake is completely dependant on entropy, hence it has no set of intelligent algorythm. It was neccessary to base the enemy intelligence on entropy to make the code significantly shorter. You are a snake you move across the screen and have to make the enemy snake bumb into your body. If your head bumps into the Enemy body you will die. Controls: <8> up <4> left <6> right <2> down --------TECHNICAL INFO, SCROLL DOWN IF YOU DON'T CREATE PROGRAMS-------- Synopsis: 1)Proposing New Algorythm For Storing HIGH SCORES 2)Proposing the replacement of Array with LIST This uses 10 cells in each of the 4 lists, to continuously refresh and store memory for the coordinates of your snake and enemy snake. The array function used in previous calculator have been replaced by List function. you can use arrays in 9850g by using the Following syntax: List 1[1] or hence List list#[cell number] Highscore can be easiley mangaed by storing and assigning the current score into List list#([Dim List list#)-1)] and doing a one step of sort via the builtin sort function. When sort is done the highscore can be called by typing list list#[Dim List list#] Now all you have to do is compare if the current score is greater or less than the currentscore. Currentscore->List list#[(Dim List list#)-1) //to prevent DIm error// SortA(List list#) List list#[Dim List list#]->highscore ------------------------END OF TECHNICAL NOTES------------------------------ NOTICE: This game uses the Lists 1 through 5 if you have important information stored in your list, such as your grade and etc. Don't Play this game. Happy Coding! :-) bug reports are always welcome :-) --HIDETAKE JO (hjo@engin.umich.edu) ------------------------------------------------------------------------ Where are the keys? =< [shift] [VARS] [F6] [F3] [F6] >= [shift] [VARS] [F6] [F3] [F5] = [shift] [.] =/= [shift] [VARS] [F6] [F3] [F2] Text [shift] [F4] [F6] [F6] [F2] Plot [shift] [F4] [F6] [F1] [F1] PlotOn [shift] [F4] [F6] [F1] [F2] PlotOn [shift] [F4] [F6] [F1] [F3] Line [shift] [F4] [F6] [F2] [F1] If [shift] [VARS] [F1] [F1] Then [shift] [VARS] [F1] [F2] IfEnd [shift] [VARS] [F1] [F4] For [shift] [VARS] [F1] [F6] [F1] To [shift] [VARS] [F1] [F6] [F2] Step [shift] [VARS] [F1] [F6] [F3] Next [shift] [VARS] [F1] [F6] [F4] While [shift] [VARS] [F1] [F6] [F6] [F1] WhileEnd [shift] [VARS] [F1] [F6] [F6] [F2] GetKey [shift] [VARS] [F6] [F4] [F2] And [OPTN] [F6] [F6] [F4] [F1] => [shift] [VARS] [F3] [F3] -> {the key right above the AC/ON sign} Isz [shift] [VARS] [F3] [F4] List [Optn] [F1] [F1] { [shift] [*] multiplication symbol } [shift] [/] division symbol [ [shift] [+] ] [shift] [-] SortA( [F4] [F3] [F1] Dim [OPTN] [F1] [F3] Note: the {} in this program is ESSENTIAL, please type them in where you see them Note: everything after the // sign are comments and should not be typed into your calculator -------------------------------------------------------------- Cls Q=<99=>{1,Q}->List 5 Q>=100=>{1,1}->List 5 ViewWindow 1,127,1,1,63,1 {1,1,1,1,1,1,1,1,1,1}->List 1 {1,1,1,1,1,1,1,1,1,1}->List 2 {1,1,1,1,1,1,1,1,1,1}->List 3 {1,1,1,1,1,1,1,1,1,1}->List 4 0->A~Z 10->A 10->C 10->B 1->D 1->E 5->M 10->G 60->H -5->I 1->Z 100->P While 1=Z P-1->P Text B,A,"O" Text list 2[D],List 1[D]," " //one space between quotations A->List 1[C] B->List 2[C] If GetKey=73 Then -5->F 0->M IfEnd If GetKey=53 Then 5->F 0->M IfEnd If GetKey=64 Then -5=>M 0->F IfEnd If GetKey=62 Then 5->M 0->F IfEnd Text G,H,"X" Text List 3[D], List 4[D]," " //one space between quotations G->list 3[C] H->List 4[C] Int 7Ran#->K If K=3 Then Int 4Ran#->L 0->I~J L=1=>5->I L=2=>-5->I L=3=>5->J L=0=>-5->J IfEnd G+I->G H+J->H A+F->A B+M->B C+1->C D+1->D H >= 125=>4->H A >= 125=>4->A H =< 3=>123->H A =< 3=>123->A G >= 62=>3->G B >= 62=>3->B G =< 3=>61->G B =< 3=>61->B C >= 11=>1->C D >= 11=>1->D For 1->N To 10 C =/= N=>A >= List 4[N]=>A =< List 4[N]+4=>B >= List 3[N]=>B =< List 3[N]+4=>0->Z C =/= N=>H >= List 1[N]=>H =< List 1[N]+4=>G >= List 2[N]=>G =< List 2[N]+4=>2->Z Next WhileEnd Z=0=>Locate 7,3,"COMP WINS" If Z=2 Then P->Q Locate 7,3,"YOU WIN" Locate 1,6,"YOUR SCORE:" Locate 12,6,P Dim List 5->V Locate 1,5,"HIGH SCORE:" P->List 5[(Dim List5)-1] SortA(List 5) Dim List 5->V Locate 12,5,List 5[V] If P=List 5[V] Then For 1->A To 50 Locate 6,7," " //10 spaces between the quotations Locate 6,7,"HIGH SCORE" Next IfEnd