[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

5 queen domination

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 34
Thread images: 5

I need help /g/. I need to write a program (in C) for a class, that would get all the solutions to the 5 queen domination problem
>>
tfw you have an easy checkmate but upgrade as many pawns as you can instead to piss off your friend John who won't resign
>>
>>59601324
Literally freshman work. Look up backtracking
>>59601376
>tfw you forget about stalemate
>>
>>59601384
>tfw u never even knew about stalemate
>>59601376
>tfw u review ur match and realise u missed mate in 2 5 times in a row
>>
>>59601324

Take your "queen domination" shit to /gif/, nobody is interested in your weird fetishes here.
>>
File: hitler feels opressed.jpg (123KB, 800x600px) Image search: [Google]
hitler feels opressed.jpg
123KB, 800x600px
>>59601458
kek
>>
>>59601324
>(in C)
Dropped
>>
>>59601324
>take 64bit integer
>iterate over all 7.624.512 permutations (5 1s and rest 0s) and check if the rules are adhered to
anyone any better ideas?
>>
File: uxuqqu3z5wrdeqimic04.jpg (69KB, 800x463px) Image search: [Google]
uxuqqu3z5wrdeqimic04.jpg
69KB, 800x463px
>>59601537
bye pajeet, have a happy javascript
>>
>>59601603
isn't there a lot more permuations than that?
>>
>>59601635
5 out of 64

[spoiler]no[/spoiler]
>>
>>59601635
for fucks sake
64 * 63 * 62 * 61 * 60

you don't need to read a combinatorics book to understand that
>>
>>59601603
Also, the checking part might be very interesting, it could involve a lot of nice bit fiddling. I'm probably going to do this.
>>
>>59601644
that's too much, you don't need all those
I think even my number was too high
you need way less permutations for the queens problem
some permutations are the same permutation as others from another viewing angle

so I'd say it depends
do you need ALL possible positions on the board or just all the positions of the queens i depending of the other queens positions?
>>
>>59601693
my engrish be very gud 2day I cee
>>
>>59601693
How did you get that number? Now that I include horizontal and vertical symmetry, it's down to 229 million, but it's still much bigger than yours.
>>
>>59601744
binomial coefficient
>>
>>59601324
1- Start with empty board, copy it
2- Place a queen on copy
3- Remove threathened squares from copy
4- Repeat 2; if copy becomes empty, backtrack (remove last queen); if 5 queens on board, you win
>>
>>59601875
Why do you have to turn everything into a maze?
>>
>>59601875
complicated and takes too long
>>
>>59601901
>>59601902
Do you guys hate optimization? It's a C class ffs
>>
>>59601909
>optimization
Where? Did I miss it?
Can't find any in your post
>>
>>59601909
It was a joke, man. I appreciate different approaches to the same problem.
>>
I never understood exercises like this.
This is an exercise in logic, not in C.
>>
File: 1475401877864.jpg (8KB, 213x237px) Image search: [Google]
1475401877864.jpg
8KB, 213x237px
What's logic got to do with C?
>>
>>59601991
>>59601947
honestly
this is still better than
>send this server a hello world
3 lines code exercise

with logic like this you have to write some "more" code
>>
So how fast can you do it /g/?
Ill start at a modest 100ms
> time python queenst.py 
[[1 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0]
[0 0 0 0 1 0 0 0]
[0 1 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0]
[0 0 0 0 0 0 0 0]]
0.08user 0.00system 0:00.09elapsed 96%CPU
>>
>>59602389
>1 solution
fucking read the OP
>>
>>59602389
also
>100ms
I can fucking think of one solution faster than that
>>
>>59602389
is it something along the lines of...
> from chess import queens
>>
>>59602437
>>59602442
Sry just woke up
> time python queenst.py 
Solutions: 10
0.20user 0.00system 0:00.20elapsed 99%CPU


>>59602455
Only numpy desu
>>
File: image.jpg (451KB, 640x1136px) Image search: [Google]
image.jpg
451KB, 640x1136px
Post this on stack overflow, also look into backtracking.
>>
>>59602442
Also
python -c 'import numpy'
takes 100ms
>>
>>59602710
Jesus Christ python is shit
Thread posts: 34
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.