Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 8 Puzzle Game
Index -> Programming, C++ -> C++ Submissions
Goto page Previous  1, 2, 3  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hkbnp




PostPosted: 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.



error.JPG
 Description:
 Filesize:  42.38 KB
 Viewed:  482 Time(s)

error.JPG


Sponsor
Sponsor
Sponsor
sponsor
hkbnp




PostPosted: 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.
wtd




PostPosted: 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.
hkbnp




PostPosted: Mon Jul 13, 2009 10:14 pm   Post subject: RE:8 Puzzle Game

"conio.h" use for windows input, it can't be missed.
A.J




PostPosted: 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.....
ahneh




PostPosted: 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.
bbi5291




PostPosted: 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.)
ahneh




PostPosted: Mon Jul 27, 2009 8:39 pm   Post subject: RE:8 Puzzle Game

Thanks bbi5291 XD
you leaded me
Sponsor
Sponsor
Sponsor
sponsor
A.J




PostPosted: 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 =)
bbi5291




PostPosted: 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 Sad ) 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...
A.J




PostPosted: 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
HRI




PostPosted: 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())
{
...
}
Insectoid




PostPosted: 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.
A.J




PostPosted: 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.
Velocity




PostPosted: Wed Jan 18, 2012 6:20 pm   Post subject: RE:8 Puzzle Game

great game, for an hours work, i love it +karma
Display posts from previous:   
   Index -> Programming, C++ -> C++ Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 3  [ 31 Posts ]
Goto page Previous  1, 2, 3  Next
Jump to:   


Style:  
Search: