| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
Yes change the T to an L in:
Repeat T=18 or 81=sum(L1 o I was bored and i figured this out... ipart(10fpart(N10^(D-1 Where N is the number and D is the decimal place you want so put in 5.0023 as N and 3 as D and it pulls out the .002, but as a whole number hope that helps Why are YOU finding all the bugs in MY program? lol |
|
|||
|
yea there is definitaly a typo somewhere because my calculator solved your sudoku, ill look over the code to see if anythings missing
|
|
||||
|
Quote:
You can't post your code directly from the program editor in TI Connect? Or do you not have a cable? |
|
||||
|
I've almost finished the menu. All I have to do is upload the puzzles to it, and finish a feature I made for it that will let you choose which puzzle you want to do (I'm thinking of uploading 15 to 30 puzzles). Anyways, it looks pretty nice, says it was made by the both of us (if you want I can put a different name in it for you), and works very quickly. The prerequisites are that the menu is named SUDOKU, your solver is named SUDOKU1, and my game is named SUDOKU2. I was also thinking of putting in a warning screen saying that it will delete both matrix A and matrix B if doing your program. Any who, here's the program:
Code:
:ClrDraw :14->X :Text(2,4,"SUDOKU PACKET :For(A,0,55 :Pxl-On(1,A :Pxl-On(9,A :End :Text(11,3,"PLAY :Text(19,3,"SOLVER :Text(27,3,"QUIT :Text(43,0,"MADE BY: :Text(49,0,"CALCFEAK AND :Text(55,0,"MUFINMCFLUFIN :Pxl-On(14,1 :1->Y :While 1 :getKey->G :While not(G :getKey->G :End :Pxl-Off(X,Y :X+8(G=34 and X*doesn't equal*30+8(Y=29))-8(G=25 and X*doesn't equal*14)->X :Pxl-On(X,Y :If Y=29 and (G=24 or G=85 or G=23:Then :Pxl-Off(X,Y :14->X :1->Y :Pxl-On(X,Y :Text(11,31," --------This is 23 spaces :Text(19,31," -----This is 47 spaces :Text(27,31," -----This is 35 spaces :Text(35,31," --------And again, 23 spaces :End :If G=26 or G=105 or G=21 or G=95:Then :If Y=1:Then :If X=14:Then :Pxl-Off(X,Y :29->Y :Pxl-On(X,Y :Text(11,31,"SIMPLE :Text(19,31,"INTERMEDIATE :Text(27,31,"DIFFICULT :Text(35,31,"CHOOSE :End :If X=22:prgmSUDOKU1 :If X=30:Then :ClrDraw:ClrHome:Stop :End :Else :If X=14:Then : <----------------------------These all are left blank because I'm not yet sure what to do with each difficulty, and how to let the chooser choose which puzzle, or even where to store the puzzles. (I'm thinking using labels, but I know that those make the program go slower...) :End | :If X=22:Then | : <-------------------| :End | :If X=30:Then | : <-------------------| :End | :If X=38:Then | : <-------------------- :End:End:End:End And one more thing, you may want to make the start up of your program so that it will input the puzzle, one number/space at a time, so to make the whole program more user-friendly. You know? Last edited by MufinMcFlufin : May 26th, 2009 at 10:11 PM. |
|
|||
|
check the line of delvars and change delvar T to delvar L
srrys 1 more thing...lol... You have to make sure the bounds are set to 0=Ymin 62=Ymax 0=Xmin 94=Xmax |
|
||||
|
Quote:
You sure that's all you have to change? For some reason it's still looping through the whole thing for me. And could you make a code that will let the user enter all the numbers in? It would look better than telling them to type all of them into a matrix, especially because most people who use calculators don't really know how to use them that well. Also, I finished the menu, and now just need to put all the levels in it and test them all. It had a MAJOR problem when I tried to insert an options button, and I literally had to reenter half the code, but it's working fine now, without the options button. I figured I should finish putting all the puzzles in first. And now that school's out (for me at least), I'll have plenty of time to work on it. Last edited by MufinMcFlufin : May 22nd, 2009 at 12:08 PM. |
|
|||
|
Yea ive got an input program in the works, i just have to debug it now maybe ill post it later...
unfortunately, i have 100 pages of Fahrenheit 451 to read and analyze before i can finish it =( |
|
||||
|
Quote:
Bummer... I'm still entering all of these puzzles, and testing all of them. I got a little sidetracked since last Friday, when my brother helped me build a new computer, and ever since I've been getting all of the necessary files and updates, and all of that, but now I'm pretty sure I've gotten everything that I need, so I can get back to work on this program. I was also able to get TI Connect on this computer so I no longer have to use my brother's computer every time I want to put files on my calc or take any off, but for some reason it won't let me modify the programs like it would let me do on his computer. Anyways, this menu is done, and just needs the final 10 puzzles. If you want, I can try and help you out with that input program. Just post what you've got so far. Oh, another thing! I found out why your solver wasn't working for me. It turns out that near the end of the code where it says "1+L1(Z->L1(Z" Code:
1->[B](A,X End 1+L1(Z->L1(Z<--------Here Z->[A](A,B End:End I accidentally had it store that value into list 2, instead of 1, which explained why it would continue to cycle when even after completion, but wouldn't do a single cycle when it's given as solved. And lastly, I actually found a puzzle that it couldn't solve! Here is the puzzle: _ _ 6 _ 2 _ _ 4 _ 7 _ 5 _ _ _ 8 _ _ 9 _ _ 1 _ _ _ _ _ _ 7 _ _ 4 _ _ 2 _ _ _ _ 9 _ 1 _ _ _ _ 1 _ _ 5 _ _ 3 _ _ _ _ _ _ 9 _ _ 4 _ _ 2 _ _ _ 7 _ 5 _ 4 _ _ 8 _ 6 _ _ And here's the solution: 1 3 6 7 2 8 5 4 9 7 2 5 3 9 4 8 6 1 9 8 4 1 6 5 2 7 3 5 7 9 8 4 3 1 2 6 2 6 3 9 7 1 4 5 8 4 1 8 6 5 2 9 3 7 6 5 7 2 1 9 3 8 4 8 9 2 4 3 6 7 1 5 3 4 1 5 8 7 6 9 2 No I didn't make it up. I got it from my Super Sudoku book from Dollar General produced by Modern Publishing, puzzle number 162 out of 163. It figured 4 or 5 of the numbers until it couldn't find out any more and quit. Which I found explained the reason why you made your repeat code say L=18. That's so it will quit if it checks each number twice, and still wasn't able to find a new number. Right? Last edited by MufinMcFlufin : May 27th, 2009 at 09:39 PM. |
|
|||
|
Quote:
actually....from L=0 to L=9? it tests on lines, like if there is a spot in a line where only a certain number can go it puts it there from L=9 to L=18 it looks in boxes but not lines...does that make sense? If it cant find any numbers in a box or line it quits the reason it doesnt do boxes until it cant find any lines is because boxes actually dont happen often and testing lines is a LOT faster than boxes |
|
||||
|
Quote:
That's true I get it That would explain why in certain parts of the code it had 2 for loops going from 0 to 2 So from 0 to 9 does it check both vertical and horizontal each time? And another question: you said earlier that it doesn't guess where numbers are, it figures them out. Is that because it checks each line and sees if a number is missing? Or does it use another method? Last edited by MufinMcFlufin : May 29th, 2009 at 11:50 AM. |
|
|||
|
yes it checks vertical and horizontal every time
what it does is it goes thru the matrix and stores a number to every place Z(the # its working on) cant be Thats where the -1s come in Then it checks the lines or boxes and if there is only 1 space Z can be, it puts it there o i finished the sudoku editor ill post it soon |
|
||||
|
Quote:
I just made a help option of the menu and it includes credits, stating that you made the solver and I did the game and menu, and clear instructions about how to play the game, what both the game and solver use (matrices, variable, etc.), and when you post the editor, I'll finish it up with how to use the solver. I'll post it in a bit, I'm just a little busy right now. |
|
|||
|
well this is a little late but here it is...
its kinda slow but whatever... Just put this code at the start of the program Code:
ClrDraw
FnOff
AxesOff
GridOff
0->Xmin
0->Ymin
94->Xmax
62->Ymax
Text(0,60, Current
Line(0,4,0,62
Line(0,4,58,62
Line(58,4,58,62
Line(58,62,0,62
Delvar L1 Delvar L2 Delvar L Delvar Z
1->dim(L3
9->dim(L1
Fill(0,L1
{9,9->dim([A]
Fill(0,[A]
For(X,0,2
For(Y,0,3
Line(2,5+19X+6Y,57,5+19X+6Y
Line(19X+6Y+1,5,19X+6Y+1
End
End
5->X:5->Y
Repeat G=105
Text(0,90,[A](Y,X
getKey->G
6Y+ipart((Y-1)/3->A
6X+ipart((X-1)/3
Line(Ans,62-A,Ans,67-A
Line(Ans-4,62-Ans,Ans-4,67-Ans
If not(G
Then
For(B,0,4 ;yea it would be shorter to have another for here, but it slows animation down
Pxl-Change(A-B,Ans-1
Pxl-Change(A-B,Ans-2
Pxl-Change(A-B,Ans-3
End
End
While not(G
getKey->G
End
If G=45 or G=23
0->[A](Y,X
If sum(G={92,93,94,82,83,84,72,73,74 ;easiest way to check if a variable equals any of a bunch of numbers
3ipart(10.4-.1G)-4+10fpart(.1G->[A](Y,X
[A](Y,X
If not(Ans
" ;4 spaces
Text(6Y-5+ipart((Y-1)/3),6X-4+ipart(X-1)/3)," ",Ans ;1 space
6Y+ipart((Y-1)/3
Line(0,67-Ans,57,67-Ans
X+(G=26)-(G=24->X
Y+(G=34)-(G=25->Y
X-9(X=10)+9not(X->X
Y-9(Y=10)+9not(Y->Y
End
For(X,1,9
For(Y,1,9
If [A](Y,X
1+L1([A](Y,X->L1([A](Y,X
End
End
startTmr->S
Repeat L=18 or 81=sum(L1
[A]->[B]
nothing in the program has been changed from there down
basically you just run the program arrows keys move the cursor press a number to place that number in the box press either clear or del to remove a number from the box press enter to stop editing and launch the solver |
|
||||
|
Quote:
Well, I tried it out, and so far, it showed most of a box with a diagonal going from the bottom left corner to the upper right corner, said CURRENT: in the top right, and then got a syntax. It looks like you're missing one of the parameters in the second Line( command shown here near the beginning of the code: Code:
For(X,0,2 For(Y,0,3 Line(2,5+19X+6Y,57,5+19X+6Y Line(19X+6Y+1,5,19X+6Y+1 ;this one End End I was able to figure out that it's suppose to have ,61 at the end as the last parameter, but soon I encountered another error. The cursor doesn't work quite as it should. The left most line of the Pxl-Change's is (almost) always in the wrong position. When the cursor is in the 3rd column going right, the left-most line will be in the 3rd row going down. Can you see what went wrong? Other than that, everything works fine. I also wanted to mention that the menu will have the same window range that you inputted, along with Axesoff, and Gridoff, so you might as well take those out to save some memory. Anyways, I can't figure out your cursor. Not the part that doesn't work, but how it goes so fast. Mine uses 4 lines around each number, and still doesn't go as fast. Speaking of which, I'm still adding this and that to my code, so I don't quite yet want to put it out on the web, but I'll give you some screen shots of it and the menu I have currently. |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > TI 83/84 > Sudoku program tips |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|