FANDOM


BackgroundEdit

Knight

For those of you familiar with the game of chess, the concept of the maze will be easier to grasp. I sat in class one day making a maze out of a grid on my graph paper. Now it can be made for a calculator! When you move, you can move two squares horizontally and one square vertically, or two squares vertically and one square horizontally. The complete move therefore looks like the letter 'L'.

Everything I have is on here. Let me know if anything is coded wrong!

ControlsEdit

Playing the Game:Edit

Choose the "Play Last Map" selection on the home menu. You start in the top left corner, your goal is to end in the bottom right corner. Your move is first shown through a "ghost" point. You use the left and right arrows to navigate the ghost point to the destination you wish to move, then press enter to confirm your choice. The ghost point will not land on a square with an obstacle, nor will it go out of bounds. The ghost points look like small squares with the middle pixel open. The obstacles are small squares with a filled in center.

Creating a Map:Edit

Choose the "Create a Map" selection on the home menu. Move using the arrows and press enter to place an obstacle. The map is automatically saved under LMAP1 (just in case you ever have trouble with the code or I typed something in wrong). Press CLEAR to save the map. Then choose "Play Last Map" to play it! The pointer looks like a cross. The confirmed obstacles look like squares with an open center.

Main Code (650)Edit



PROGRAM:KNIGHT

:Lbl 01
:SetUpEditor LMAP1
:ClrDraw
:CoordOff
:AxesOff
:0→Xmin:-62→Ymin
:1→ΔX:1→ΔY
:For(H,0,-60,-6
:Line(0,H,90,H
:End
:For(V,0,90,6
:Line(V,0,V,-60
:End
:For(V,91,95
:Line(V,0,V,-60
:End
:Menu("MAIN MENU","PLAY LAST MAP",A,"CREATE A MAP",B,"RANDOM MAP",C
:Lbl B
:prgmθMAPS         //This stub is written below.
:Goto 01
:Lbl C
:prgmθMAPGEN       //This stub is written below.
:Goto 11           //Sorry about all of the redirects, I realize it's probably not the most professional way to go about this.
:Lbl A
:For(X,1,dim(LMAP1
:LMAP1(X)→A
:Pt-On(3iPart(A),-300fPart(A),2
:Pt-On(3iPart(A),-300fPart(A),3
:End
:Lbl 11
:3→X
:-3→Y
:1→A
:While 1
:Pt-Off(B,C,2
:Repeat K
:Lbl 1
:Pt-On(X,Y,2
:If A=1
:Then
:X+6→B:Y-12→C
:End
:If A=2
:Then
:X-6→B:Y-12→C
:End
:If A=3
:Then
:X-12→B:Y-6→C
:End
:If A=4
:Then
:X-12→B:Y+6→C
:End
:If A=5
:Then
:X-6→B:Y+12→C
:End
:If A=6
:Then
:X+6→B:Y+12→C
:End
:If A=7
:Then
:X+12→B:Y+6→C
:End
:If A=8
:Then
:X+12→B:Y-6→C
:End
:A+(C>0)+(B<0)+(C<-60)+(B>90→A
:If C<0 and B>0 and C>-60 and B<90
:A+pxl-Test(-C,B→A
:Pt-On(B,C,2
:getKey→K
:A+(K=26)-(K=24→A
:A-8(A=9)+8(A=0→A
:If K=105
:Then
:Pt-Off(X,Y,2
:B→X
:C→Y
:End
:If X=87 and Y=-57
:Goto W
:End
:End
:Lbl W
:Disp "YOU WIN!
:Stop

θMAPS (200)Edit

PROGRAM:θMAPS
:ClrDraw
:For(V,0,90,6
:Vertical V
:End
:For(H,0,-60,-6
:Horizontal H
:End
:1.01→A
:{0}→LMAP1
:While 1
:Pt-On(3iPart(A),-300fPart(A),3
:Repeat K
:getKey→K
:End
:Pt-Off(3iPart(A),-300fPart(A),3
:A+2(K=26)-2(K=24)-.02(K=25)+.02(K=34→A
:If K=105
:Then
:Pt-On(3iPart(A),-300fPart(A),2
:A→LMAP1(dim(LMAP1)+1
:A+2→A
:End
:If K=45
:Return
:End

θMAPGEN (300)Edit

:ClrHome
:Menu("DIFFICULTY","EASY (20)",A,"MED (40)",B,"HARD (60)",C,"CUSTOM",D
:Lbl A
:20→X
:Goto 1
:Lbl B
:40→X
:Goto 1
:Lbl C
:60→X
:Goto 1
:Lbl D
:Input "NUM OF BLOCKS:  ",X       //Two spaces
:If X>90                          //After this number it starts becoming impossible.
:Then
:Disp "TOO MANY!
:Goto D
:End
:Lbl 1
:1→A
:1→B             //I can't remember why I have 1 stored in here...haha
:Pt-On(9,-15
:Pt-On(15,-9
:Pt-On(75,-51
:For(Y,1,iPart(X),1
:Lbl AA
:randInt(2,14→A
:randInt(1,10→B
:6A-3→A:6B-3→B
:If pxl-Test(B,A)
:Goto AA
:Pt-On(A,-B,2
:Pt-On(A,-B,3
:End
:Pt-Off(9,-15
:Pt-Off(15,-9
:Pt-Off(75,-51



ExplanationEdit

:Lbl 01
:SetUpEditor LMAP1
:ClrDraw
:CoordOff
:AxesOff

Sets everything up.

:0→Xmin:-62→Ymin
:1→ΔX:1→ΔY

Plots the graph screen. Both the X and Y start at 0 and 1 pixel=1 coordinate point.

:For(H,0,-60,-6
:Line(0,H,90,H
:End
:For(V,0,90,6
:Line(V,0,V,-60
:End
:For(V,91,95
:Line(V,0,V,-60
:End

Sets up the grid where you will play your game.

:Menu("MAIN MENU","PLAY LAST MAP",A,"CREATE A MAP",B,"RANDOM MAP",C

Menu where you are sent to your option choice

:Lbl B
:prgmθMAPS         //This stub is written below.
:Goto 01
:Lbl C
:prgmθMAPGEN       //This stub is written below.
:Goto 11

Redirects you to the different programs

:Lbl A
:For(X,1,dim(LMAP1
:LMAP1(X)→A
:Pt-On(3iPart(A),-300fPart(A),2
:Pt-On(3iPart(A),-300fPart(A),3
:End

Assuming a map is stored in the list (in the correct syntax) this will plot the black blocks.

:Lbl 11
:3→X
:-3→Y
:1→A

X and Y are the coordinates of the chosen points. 3,-3 places them in the first sqaure in the top left corner.

:While 1
:Pt-Off(B,C,2
:Repeat K

The beginning of both of the loops. The reason for the "repeat" code is so that the ghost piece doesn't blink on and off. It will only redraw it if you press a key.

:Lbl 1
:Pt-On(X,Y,2

Draws the innitial point.

:If A=1
:Then
:X+6→B:Y-12→C
:End
:If A=2
:Then
:X-6→B:Y-12→C
:End
:If A=3
:Then
:X-12→B:Y-6→C
:End
:If A=4
:Then
:X-12→B:Y+6→C
:End
:If A=5
:Then
:X-6→B:Y+12→C
:End
:If A=6
:Then
:X+6→B:Y+12→C
:End
:If A=7
:Then
:X+12→B:Y+6→C
:End
:If A=8
:Then
:X+12→B:Y-6→C
:End

This is the algorithm that determines where the ghost piece is. Since there are 8 possible moves, there are 8 values for A. ...to be continued... Rianbay812 03:56, April 28, 2012 (UTC)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.