# # C o n n e c t 4 ! # # by Tom Wheeley. # # A semi-graphical Connect 4 program for the fx9700 calculator, make sure # you also enter the correct names in programs A and B. # # This program is CaS compatible! @@ Prog A ( ) "Player 1" @@ Prog B ( ) "Player 2" @@ Prog C ( ) "Connect 4" # Draw screen Prog Z 127->X:Lbl 1 Plot X,2 Plot X,62:Line X-18->X:X>0=>Goto 1 62->Y:Lbl 2 Plot 1,Y Plot 126,Y:Line Y-10->Y:Y>0=>Goto 2 # Initialise 0->B~H:T<>0=>1->T 4->R #Program loop Lbl 3 T=0=>"[O]":T<>0=>"[0]" T=0=>Prog A T<>0=>Prog B "Column (1-7)"?->A ; Enter column number A<>Abs Int A=>Goto 3 A>7=>Goto A=0=>Goto 4 A[A]=6=>"Column full!" A[A]=6=>Goto 3 Isz A[A] 18A-8->P:10A[A]-3->Q ; Calculate position on screen Prog O:1-T->T Lbl 4:Plot 0,0_ ; Show screen Goto 3 @@ Prog O ( ) R->V:Lbl 1:\sqrt( R\sqr - V\sqr -> U ; Circle drawing routine. It moves Plot P+U,Q+V ; X from the Radius to 0, using Plot P-U,Q-V ; Pythagorus to calculate Y. To T<>0=>Line ; save time 4 way symmetry is used. Plot P+U,Q-V Plot P-U,Q+V T<>0=>Line Plot P+V,Q+U Plot P-V,Q-U T<>0=>Line Plot P+V,Q-U Plot P-V,Q+U T<>0=>Line Dsz V:Goto 1 @@ Prog Z ( ) Range 1,127,0,1,63,0 ; Set Range 64->X:32->Y