User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 363,445 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,234 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 763 | Replies: 19 | Solved
Reply
Join Date: May 2008
Location: Infinte Castle, below Beltline
Posts: 182
Reputation: Prabakar is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Junior Poster

Re: Horse Game

  #11  
May 4th, 2008
I understand a little. And also, could you help me with your code please
Reply With Quote  
Join Date: May 2008
Location: Infinte Castle, below Beltline
Posts: 182
Reputation: Prabakar is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Junior Poster

Re: Horse Game

  #12  
May 4th, 2008
I use conio.h because thats what I have learned so far. Help me please, what is the better, how do I learn it & where do I get the compiler for it
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 666
Reputation: jephthah has a spectacular aura about jephthah has a spectacular aura about jephthah has a spectacular aura about 
Rep Power: 4
Solved Threads: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a Master Poster

Re: Horse Game

  #13  
May 4th, 2008
for windows development, i use the Microsoft Visual C compiler. The "Express Edition" is completely free, and its the industry standard if you're developing PC apps. you can get previous versions (like 2005) if the 2008 doesnt work with your machine.

GCC would be the one for linux/unix

i mean, but hey, if you've got a project due, and you're allowed to use non-portable non-standard libraries like CONIO and BIOS... and you're used to workign with them, then dont change right now

just be aware, that these libraries will continue to haunt you and eat your soul until you exorcise them from your life.

as for my code, its working now just fine. and solves the Knight's Tour from any position on an 8x8 board in a few seconds .. would be a lot faster, but i display the board and moves to a terminal display, and that slows it down a lot.

but i can't just go and give it to you. that would defeat the point of you learning how to write your own code to solve problems.

all i did was use the old Warnsdorff's Algorithm. the algorithm itself is pretty simple, and has been around for some 200 years, to solve this exact problem.


.
Last edited by jephthah : May 4th, 2008 at 5:22 am.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 666
Reputation: jephthah has a spectacular aura about jephthah has a spectacular aura about jephthah has a spectacular aura about 
Rep Power: 4
Solved Threads: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a Master Poster

Re: Horse Game

  #14  
May 4th, 2008
its hard for me to understand exaclty what you're doing.

are you trying to solve the knight's tour, once for each of the 64 starting positions?

does it matter whether the solution is open or closed? what exactly are you storing and recovering in the text files?

because there are literally trillions (million-millions) of closed solutions. i cant imagine you needing to provide more than one solution for each starting square.

if it helps any, each 64-round "tour" should be easily solved by the computer program in less than 5 seconds, and thats just overhead for various I/O. without printing to screen, should be much less than 1 second.

if it's hanging on you, you've got some major problem(s) somewhere, probably an infinite loop.
Reply With Quote  
Join Date: May 2008
Location: Infinte Castle, below Beltline
Posts: 182
Reputation: Prabakar is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Junior Poster

Re: Horse Game

  #15  
May 4th, 2008
I find the algorithm Interesting, thank you.
I'll soon work with it after my semester exams are over.

Just now I have installed Win XP after the virus attack. I learned my lesson. Ill never download softwares in college. I will install Visual studio soon & learn visual C.

About recover.txt, I was tempted to find answers exhaustively, & I knew, there must be lots & lots of answers, So I used recover.txt to save the progress of the program & then when I run it back, it would continue with next answers.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 666
Reputation: jephthah has a spectacular aura about jephthah has a spectacular aura about jephthah has a spectacular aura about 
Rep Power: 4
Solved Threads: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a Master Poster

Re: Horse Game

  #16  
May 4th, 2008
theres no "learning" visual c. if you're using the free MSVC compiler, it's still just C...

MS compiler and libraries still has non-ANSI portability problems compared to GCC (linux) but given MS history, it could be a lot worse.

it at least doesnt introduce addtional problems such as what Borland does.

sorry about your virus problems. i doubt it has anything to do with college.

i still don't quite understand what you were trying to do... were you trying to solve "EVERY" possible solution from each of the 64 squares? the closed solutions alone number around 26,000,000,000,000 solutions.

i dont think you're going to get that accomplished anytime soon on your old Dell PC.
Reply With Quote  
Join Date: May 2008
Location: Infinte Castle, below Beltline
Posts: 182
Reputation: Prabakar is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Junior Poster

Re: Horse Game

  #17  
May 5th, 2008
Thank you, for those details. And then we download softwares during lab hours and take it home with our pen drive. Recently, some viruses and trojan horses spreaded all over the lan & to my pen drive. Thats how it happened. Anyway now the lab incharge is fixing it.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 666
Reputation: jephthah has a spectacular aura about jephthah has a spectacular aura about jephthah has a spectacular aura about 
Rep Power: 4
Solved Threads: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a Master Poster

Re: Horse Game

  #18  
May 5th, 2008
o i see. that's gotta suck. i guess i remember now, back in early 2000's, when a particularly nasty virus went around our university (a major state research institution) .... it really wreaked havoc on everyone for a good month or so. the good thing was, they finally got some competent security people in the sys admin department after that.



so this exercise of yours wasn't a homework assignement? just a personal project?



oh, and thanks for the comment.


.
Last edited by jephthah : May 5th, 2008 at 10:27 am.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 666
Reputation: jephthah has a spectacular aura about jephthah has a spectacular aura about jephthah has a spectacular aura about 
Rep Power: 4
Solved Threads: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a Master Poster

Re: Horse Game

  #19  
May 19th, 2008
hey prabkar

i posted my attempt at solving the Knights Tour. code and Windows-based executable are here

http://www.daniweb.com/forums/post60...tml#post609519
I drink your milkshake.
Reply With Quote  
Join Date: May 2008
Location: Infinte Castle, below Beltline
Posts: 182
Reputation: Prabakar is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Junior Poster

Re: Horse Game

  #20  
May 19th, 2008
I read the program & I understood. It is a nice & Thanks a lot.
I want to write the same in windows based, and I will try & soon after I finish, I will ask for improvements. Ofcourse this would be my first windows based program.

And also I have never ever used enum before because I dint know where to use it. you have just shown me a way of using it, thanks for that too.
Last edited by Prabakar : May 19th, 2008 at 4:38 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 2:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC