All that is necessary for evil to succeed is that good people do nothing! Support Act for America

programming help - Anarchist Cookbook
Anarchist Cookbook  

Go Back   Anarchist Cookbook > Anarchist Cookbook > Hacking > Programming

Programming Got code?

Reply
 
Thread Tools Search this Thread Display Modes
Old March 26th, 2008   #1
Sas
Junior Member
Points: 2,870, Level: 22
Points: 2,870, Level: 22 Points: 2,870, Level: 22 Points: 2,870, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 

Last Online: May 7th, 2009 02:01 PM
Join Date: Jul 2005
Location: .......
Posts: 13
Cash Credits: 891
Sas RSS Feed
programming help

Lab #8 8
Queens
For this lab, you are to write a program that will figure out how to place 8 queens on a standard 8x8 chess
board such that no queen can capture any other and display the board to the user. Your program must
derive the answer logically, i.e. you cannot write a program with just a printf() statement. An example
output is shown:
_ _ _ _ _ _ _ _
|0|0|0|X|0|0|0|0|
|0|0|0|0|0|0|X|0|
|0|0|X|0|0|0|0|0|
|0|0|0|0|0|0|0|X|
|0|X|0|0|0|0|0|0|
|0|0|0|0|X|0|0|0|
|X|0|0|0|0|0|0|0|
|0|0|0|0|0|X|0|0|
The simplest way for your program to find a solution would be a brute force algorithm trying every single
possibility until a valid solution is found, but considering that there are 64!/(648)!
or
178,462,987,637,760 possibilities, you'll find that this takes far too long. If you have a really really fast
computer and it could test 1 billion possibilities a second, this would take nearly 124 days to compute all
possibilities, although a solution would likely be found sooner. Obviously, some method of reducing
possibilities is needed.
This lab should take more than 1 week. The appropriate amount of time will be given to any student
requiring more. It would be a good idea to run whatever solution you come up with by your TA before
proceeding to program it.
Hints: One such way to reduce possibilities is to keep in mind that upon placing the first queen on the
chess board, 15 of the squares are not possible choices for the next queen. Upon placing the second, 13
additional squares are not possible, then 11, 9, 7, 5, 3. Given an arbitrary first placement, there are 1*(6415)*(
641513)*...*(
641513119753)
or 25,401,600 possibilities. This order of magnitude is much
more manageable than 178,462,987,637,760.
Recursion could be extremely helpful in coming up with a solution to this problem.
__________________
...It's that look on thier face....when you know you are about to die...
Sas is offline   Reply With Quote
Old March 26th, 2008   #2
ishkur88
Senior Member
Points: 5,313, Level: 31
Points: 5,313, Level: 31 Points: 5,313, Level: 31 Points: 5,313, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
ishkur88's Avatar
 

Last Online: 2 Days Ago 06:01 PM
Join Date: Nov 2006
Location: the internet.
Age: 25
Posts: 1,104
Cash Credits: 6,005
ishkur88 RSS Feed
Send a message via AIM to ishkur88 Send a message via MSN to ishkur88 Send a message via Yahoo to ishkur88
that problem is a bitch. being a PHP man myself, my first instinct would be to code it in PHP, but you're probably in C or C++ classes...

here's an example of some outcomes..

if you want to take a look at some C code, here's some solutions..
might give some help to read about it as well..
so.. good luck.
__________________
I am not young enough to know everything.
ishkur88 is offline   Reply With Quote
Old April 1st, 2008   #3
Sas
Junior Member
Points: 2,870, Level: 22
Points: 2,870, Level: 22 Points: 2,870, Level: 22 Points: 2,870, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 

Last Online: May 7th, 2009 02:01 PM
Join Date: Jul 2005
Location: .......
Posts: 13
Cash Credits: 891
Sas RSS Feed
yeah lol thanks...we have checked out the wikipedia thing too....bastards didnt give an example of the code though....
__________________
...It's that look on thier face....when you know you are about to die...
Sas is offline   Reply With Quote
Old May 31st, 2008   #4
need2Blove
Member
 

Last Online: July 12th, 2008 03:23 AM
Join Date: May 2008
Posts: 30
Cash Credits: 1,263
need2Blove RSS Feed
Post thanks for sharing dude!

thanks for sharing dude!______________________________Your forever friend lifts you up in spirits and makes that dark and empty maple story mesos world suddenly seem bright and full.

Last edited by deathlord888; October 19th, 2008 at 09:45 AM..
need2Blove is offline   Reply With Quote
Reply

Tags
im a noobd


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

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:49 AM.


Powered by Anarchy and vBulletin® Version 3.7.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios