Author |
Message |
hkbnp
|
Posted: Sun Jul 12, 2009 10:16 pm Post subject: Re: 8 Puzzle Game |
|
|
it can compile. Also move up/down/left/right is no problem. but when i press "space" to solve the puzzle. it get error.
pls find the error as attachment.
Description: |
|
Filesize: |
42.38 KB |
Viewed: |
527 Time(s) |
![error.JPG](uploads/attachments/thumbs/t_error_161.jpg)
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
hkbnp
|
Posted: Sun Jul 12, 2009 10:17 pm Post subject: RE:8 Puzzle Game |
|
|
it seem i get trouble in function "encode"
i want to write a 6x6 puzzle game for my friend.
should i modify the encode function?
so i am modifying the 3x3 puzzle code.
|
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Mon Jul 13, 2009 12:01 pm Post subject: Re: RE:8 Puzzle Game |
|
|
andrew. @ Mon Jul 13, 2009 12:08 am wrote: I don't do much with C++ so I don't know about the IO modules, but I did some research about conio.h and it turns out that conio was used in the MS-DOS days and is no longer a standard library in C. The websites I've been reading recommend to use stdio.h instead. Like I said before, I don't do much with C++, so don't get mad at me if I'm totally wrong with this information.
The "conio.h" header was never a part of any language standard.
|
|
|
|
|
![](images/spacer.gif) |
hkbnp
|
Posted: Mon Jul 13, 2009 10:14 pm Post subject: RE:8 Puzzle Game |
|
|
"conio.h" use for windows input, it can't be missed.
|
|
|
|
|
![](images/spacer.gif) |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Tue Jul 14, 2009 10:54 pm Post subject: RE:8 Puzzle Game |
|
|
like I said in the pm i sent you, I don't think it is a good idea just trying to update my code for a 6*6.....it is too inefficient to do that....
try coding up an A* algorithm for the program trying to make.....
|
|
|
|
|
![](images/spacer.gif) |
ahneh
|
Posted: Mon Jul 27, 2009 5:23 am Post subject: RE:8 Puzzle Game |
|
|
hi A.J,
i have seen your source codes. But i cant analyzed whether is A star search or breadth first search.
Anyone can tell me ?
thanks a lot.
|
|
|
|
|
![](images/spacer.gif) |
bbi5291
|
Posted: Mon Jul 27, 2009 11:12 am Post subject: Re: 8 Puzzle Game |
|
|
It uses a simple FIFO queue, so it would be breadth-first search. A* is an improved version of Dijkstra's, so it would use a priority queue.
Note that there are only 8!/2 = 20160 possible configurations of the 8-puzzle board. Using A* would be overkill. (In the 15 puzzle, this increases to 15!/2 = 653837184000, so then A* or something similarly efficient becomes necessary.)
|
|
|
|
|
![](images/spacer.gif) |
ahneh
|
Posted: Mon Jul 27, 2009 8:39 pm Post subject: RE:8 Puzzle Game |
|
|
Thanks bbi5291 XD
you leaded me
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Tue Jul 28, 2009 3:15 pm Post subject: RE:8 Puzzle Game |
|
|
thanks brian
I am at MathCamp, so I can't get the time to answer all of the questions.
thanks =)
|
|
|
|
|
![](images/spacer.gif) |
bbi5291
|
Posted: Tue Jul 28, 2009 9:34 pm Post subject: Re: 8 Puzzle Game |
|
|
Is that the USA-Canada Mathcamp? The one with the qualifying quiz?
I was invited to that in grade 9 and grade 10 (but I can't go because I'm too poor ) but they didn't invite me this year. Either they decided I sucked too much (unlikely considering that they invited me before) or they realized I was ignoring them...
|
|
|
|
|
![](images/spacer.gif) |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Wed Jul 29, 2009 11:48 pm Post subject: RE:8 Puzzle Game |
|
|
u serious?
wow...I'll ask them why
i am pretty sure that you should hav gotten in
|
|
|
|
|
![](images/spacer.gif) |
HRI
|
Posted: Thu Apr 28, 2011 12:26 am Post subject: Re: 8 Puzzle Game |
|
|
Great work! I must bring up a point, however.
c++: |
while (true)
{
if (kbhit())
in = getch();
...
}
|
That loop uses a ton of CPU and if you happen to have a computer where the fan is loud when the CPU is being used, it gets really annoying to do input.
A less-CPU-intensive, and shorter too, way is as follows:
c++: |
while (in = getch())
{
...
}
|
|
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Thu Apr 28, 2011 2:20 pm Post subject: RE:8 Puzzle Game |
|
|
I feel I should point out that the time-stamp on the last post is from 2009. OP has 5 posts total. Safe to assume he won't read your post and wouldn't care if he did.
|
|
|
|
|
![](images/spacer.gif) |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Thu Apr 28, 2011 9:28 pm Post subject: RE:8 Puzzle Game |
|
|
Well, I coded this a long time ago. It is currently in my USB under 'Ancient Projects'. But thanks for pointing that out, HRI. However, like Insectoid mentioned, make sure you reply to recent threads.
|
|
|
|
|
![](images/spacer.gif) |
Velocity
![](http://compsci.ca/v3/uploads/user_avatars/1809397984eb9e2888e99b.jpg)
|
Posted: Wed Jan 18, 2012 6:20 pm Post subject: RE:8 Puzzle Game |
|
|
great game, for an hours work, i love it +karma
|
|
|
|
|
![](images/spacer.gif) |
|