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.
>>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?
>>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.
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
Post this on stack overflow, also look into backtracking.
>>59602442
Alsopython -c 'import numpy'takes 100ms
>>59602710
Jesus Christ python is shit