Author Topic: Classic 8 Queens Puzzle  (Read 4581 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Classic 8 Queens Puzzle
« on: May 01, 2020, 11:53:58 am »
This is the classic 8 Queens Puzzle.  Using the mouse, place all 8 queens on the chessboard so that they do not threaten each other.  No Queens can share the same row, column, or diagonal. When Queens are in conflict, they turn red.  Pressing SPACE will restart the puzzle.

- Dav

 
8QueensPuzzle.jpg
 
Download Source -->

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Classic 8 Queens Puzzle
« Reply #1 on: May 01, 2020, 05:02:27 pm »
Nice! I took a look at the code, all that in 600 lines.

I never solved this as a kid, because I only owned 1 chess board, meaning just two queens! :D

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Classic 8 Queens Puzzle
« Reply #2 on: May 01, 2020, 08:18:28 pm »
I several times solved the mini-game of having the *most* unavailable moves as opposed to the least, but finally got it after a try or two. Nice work Dav.

This program has more queens than a drag race.
Untitled.png
* Untitled.png (Filesize: 81.27 KB, Dimensions: 395x131, Views: 266)
You're not done when it works, you're done when it's right.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Classic 8 Queens Puzzle
« Reply #3 on: May 02, 2020, 11:23:23 am »
Thanks ya'll.  I'm planning to put together a full chess board, with all the moving pieces next.

- Dav

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Classic 8 Queens Puzzle
« Reply #4 on: May 02, 2020, 02:34:38 pm »
I made a screen 0 chess game. I recall a couple of bugs, and since I' not an avid chess player, I punted on the project, and went on to other things. They were complicated bugs, not easily reproduced, I think just involving a couple of checkmate situations. Of course since I wasn't really playing it, there might have been more issues. I had asked TheBOB about designing chess pieces, and that's when his graphics chess project began. Sure not nearly as showy as my SCREEN 0 stuff, but what are you gonna do? I think I helped add piece movement, but TheBOB liked using CALL ABSOLUTE. I'm a CALL INTERRUPT guy! Come to think of it, the whole chess thing got started because Mac wanted some of us to hop on board (excuse the pun) with this Danish chess knock off, called Kriegspiel Referee. There is an entire sub-forum at QBF devoted to that project:

https://www.tapatalk.com/groups/qbasic/kriegspiel-referee-f188265/

While I was contributing, I made my chess game. It was just easier to do the whole, than to just code my part in the project. More fun, too. Michael Calkins worked out the legal move part. The way I went about it for my game, was decidedly different than his method.

Anyway, good luck with the project. Now you'll have to beef up that mouse routine of yours a bit, with all the additional chess pieces this game will need. Why is that? Because you can play real chess with only a drag queen mouse routine!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Classic 8 Queens Puzzle
« Reply #5 on: May 02, 2020, 08:32:46 pm »
Thanks for the link, Pete!  The Qbasic Forum is a treasure trove with many good programmers like Michael Calkins.  You've been a faithful guardian of the forum for a long time.  Many thanks.  Although I've seldom posted there, I browse it often.

I started working on a chess solitaire game tonight (4x4 board).  Working out valid moves is good challenge for me.  Finding a hiding spot from my wife to do some coding is proving to be a harder challenge!

- Dav

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Classic 8 Queens Puzzle
« Reply #6 on: May 02, 2020, 10:22:35 pm »
You know when Network54 hosted QBF, I put up a special page with all of the programs from TheBOB. Galleon then included those in a TheBOB QB64 samples folder. Now that Fell has reworked all of Bob's the CALL ABSOLUTE mouse routines, I'm considering re-upping that page. Unfortunately, because it had a screen shot format, it wasn't compliant enough for Tapatalk to migrate it.

Good luck with the project, and if you want the wife to leave you alone, just do like I do and pretend you're up for an all nighter. Then, she'll be the one who's hiding and yo can go code in front of TheBIG Screen.

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/