Free Republic
Browse · Search
News/Activism
Topics · Post Article

Skip to comments.

Simple Brain Exercise Can Boost IQ
New Scientist ^ | 4-28-2008 | Alison Motluk

Posted on 04/28/2008 7:25:57 PM PDT by blam

click here to read article


Navigation: use the links below to view more comments.
first previous 1-2021-4041-6061 next last
To: RaceBannon

Not C++ ! No dear friends! The real thing!

This compiles and runs with gcc on cygwin. You may infer the input format from the input loop in main() ... ‘_’ for blanks and digits ‘1’-’9’ for themselves. Other characters are ignored, so I normally use spaces and newlines to from a grid for input.

The output is verbose, and it finds all solutions. Usually it doesn’t have to TRY (i.e. guess) but this is actually a very efficient strategy when it has to resort to it, which it does if the basic rules of uniqueness, and row, column, and square inference fail. Only rarely does it have to go to a second level of guessing.


41 posted on 04/28/2008 11:01:46 PM PDT by dr_lew
[ Post Reply | Private Reply | To 40 | View Replies]

To: RaceBannon

That would be good, old-fashioned C there, FRiend. :-)


42 posted on 04/28/2008 11:45:05 PM PDT by TChris ("if somebody agrees with me 70% of the time, rather than 100%, that doesnÂ’t make him my enemy." -RR)
[ Post Reply | Private Reply | To 40 | View Replies]

To: RaceBannon

First time I’ve seen that. I think I could have it done by next March. LOL


43 posted on 04/29/2008 12:41:50 AM PDT by DoughtyOne (McCain is a poison pill. Accept it! http://www.freerepublic.com/focus/f-news/2006492/posts)
[ Post Reply | Private Reply | To 36 | View Replies]

To: RaceBannon

Let me ask, is there only one answer, or can there be a variety of answers? At first blush, it looks like there could be more than one.


44 posted on 04/29/2008 12:45:17 AM PDT by DoughtyOne (McCain is a poison pill. Accept it! http://www.freerepublic.com/focus/f-news/2006492/posts)
[ Post Reply | Private Reply | To 38 | View Replies]

To: DoughtyOne

I think there can be some with multiple answers, when within one 9 cell square, you have a 2 digit combination that is identical to the cell above it or beside it that is missing, and in the same column or row to the side


45 posted on 04/29/2008 6:57:20 AM PDT by RaceBannon (Innocent until proven guilty; The Pendleton 8: We are not going down without a fight)
[ Post Reply | Private Reply | To 44 | View Replies]

To: Enchante

The exercise is the goal, winning or losing is not; so long as the games are carried out without memory errors, the mind is exercised more than sufficiently. I used to play Chess for the winning and hated the losing. Now, at my age the mental exercise is more important to me.


46 posted on 04/29/2008 8:38:13 AM PDT by MHGinTN (Believing they cannot be deceived, they cannot be convinced when they are deceived.)
[ Post Reply | Private Reply | To 31 | View Replies]

To: DoughtyOne; RaceBannon

Sudokus with multiple answers are considered flawed.


47 posted on 04/29/2008 8:44:31 AM PDT by Revolting cat! (You're gonna cry 96 tears!)
[ Post Reply | Private Reply | To 44 | View Replies]

To: Revolting cat!

We knew my daughter had brain damage, and it’s just useful information to know what part is working well and what isn’t.

For example, I used to have to repeat everything that I said to my daughter. I took her to the audiologist, and her hearing was fine.

The bad public school said she was fine, but I knew differently.

Finally, we had an independent evaluation from a neuropsychologist. She’s the one that found the short term memory problems. Now, I’ve learned tricks on how to make sure my daughter can remember something I tell her. If I can’t write something down, then I have her repeat what I say back to me. After she does that a few times, it gets put in long term memory and she’s okay.

Once we understood what wasn’t working well, we’ve been able to get her appropriate help. Also, there are things you can do to help short term memory. Practice actually does help.


48 posted on 04/29/2008 10:44:30 AM PDT by luckystarmom
[ Post Reply | Private Reply | To 24 | View Replies]

To: Revolting cat!; RaceBannon
Thanks to both of you for your thoughts on this. I can't believe that I've gotten this far in life without seeing a Sudokus before.

When I looked at the first blank provided by RaceBannon, it seemed to me like multiple solutions might be possible. It wasn't readily apparent that it was locked in to only one solution, especially with only one number on multiple rows and columns. I will say that it did occur to me that being a high level numbers brain teaser, that there could be just one solution if configured right. That's why I asked.

I can see rationality behind both your answers, and I appreciate your responses. I'm goint to check these out further.

49 posted on 04/29/2008 1:08:19 PM PDT by DoughtyOne (McCain is a poison pill. Accept it! http://www.freerepublic.com/focus/f-news/2006492/posts)
[ Post Reply | Private Reply | To 47 | View Replies]

To: DoughtyOne; RaceBannon
A sudoku creator, and there are some celebrity sudoku creators, believe it or not, is supposed to test each puzzle on several solvers before publishing it, to verify that it is solvable and that it has a single unique solution. But, I've run into a sudoku in my local newspaper that had two solutions.

The mania hit England before it hit the States, and several years ago, some newspaper, I think it was the Guardian, organized a sudoku contest and promotion where they painted a puzzle on a hill somewhere challending the readers to solve it. Well, it turnout that the puzzle had not just two or four but hundreds of possible solutions, and the whole promotion went pop, pop, fizz, fizz!

50 posted on 04/29/2008 2:59:48 PM PDT by Revolting cat! (You're gonna cry 96 tears!)
[ Post Reply | Private Reply | To 49 | View Replies]

To: Revolting cat!

Thanks for the background. It was interesting. That hillside blank figuring in the paper’s contest must have been very embarassing. It may have actully given the game some additional publicity. Hope it didn’t put people off Sudoku though.


51 posted on 04/29/2008 5:52:28 PM PDT by DoughtyOne (McCain is a poison pill. Accept it! http://www.freerepublic.com/focus/f-news/2006492/posts)
[ Post Reply | Private Reply | To 50 | View Replies]

To: blam

My Friday night sushi waiter totally took everyone’s order by memory - he gets PAID to enhance his IQ. The extra-genius part was when the rolls arrived, though... mmmmMMm


52 posted on 04/29/2008 11:26:10 PM PDT by MonicaG (Help Wanted: Conservative leadership '08)
[ Post Reply | Private Reply | To 1 | View Replies]

To: DoughtyOne; Revolting cat!

but there can easily be more than one solution

if, in one row, you need a 4 and a 7

AND in 2 columns you needed a 4 and 7, each column

it is possible to transpose the 4’s and 7’s

the same with 2 rows and one column

That is probably explained with a picture more

lets see

x x x .. _ _ x .. x x x .. 4, 7
x x x .. x x x.. x x x
x x x .. x x x .. x x x

x x x .. x x x .. x x x
x x x .. _ _ x .. x x x .. 4,7
x x x .. x x x .. x x x

x x x .. x x x .. x x x
x x x .. x x x .. x x x
x x x .. x x x .. x x x

now, look at the matrix
each _ is where a 4 or 7 could go to complete the puzzle
horizontally, you need only ONE of them, a 4 OR a 7 to complete the row, and vertically the same, but if you look how they are arranged, the 4 and 7 are interchangable

this is the easiest way to show that more than 1 answer is okay


53 posted on 04/30/2008 11:03:28 AM PDT by RaceBannon (Innocent until proven guilty; The Pendleton 8: We are not going down without a fight)
[ Post Reply | Private Reply | To 49 | View Replies]

To: Revolting cat!

but I do get your point. :)


54 posted on 04/30/2008 11:06:50 AM PDT by RaceBannon (Innocent until proven guilty; The Pendleton 8: We are not going down without a fight)
[ Post Reply | Private Reply | To 47 | View Replies]

To: dr_lew

Why type all that when you can have a sudoku solver like this:

def r(a):i=a.find(’0’);~i or exit(a);[m
in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for
j in range(81)]or r(a[:i]+m+a[i+1:])for m in’%d’%5**18]
from sys import*;r(argv[1])

(The above code is in Python)
(I didn’t write the above code)
(Who said Python was readable?)


55 posted on 04/30/2008 11:42:16 AM PDT by dan1123 (If you want to find a person's true religion, ask them what makes them a "good person".)
[ Post Reply | Private Reply | To 37 | View Replies]

To: dan1123

This program is “pure trial”. Here’s the C equivalent, which to be sure is more prolix than Python. It’s very slow, but it does work. Actually, it solved the puzzle in this thread in 0.562 seconds, compared to 0.016 seconds for mine, so what the heck. BTW, I never heard of Python before, so thanks for mentioning it.

main(argc,argv)
int argc;
char **argv;
{ s(argv[1]); }
s(p)
char *p;
{
char grid[81]; int i,j; char m;
for( i=0 ; i<81 && p[i] != ‘0’; ++i);
if( i == 81 ){ printf(”%.81s\n”,p); exit(0); }
for( j=0 ; j<81 ; j++ ) grid[j]=p[j];
for( m=’1’ ; m<=’9’ ; ++m ) { for( j=0 ; j<81 ; j++ ){
if( ( i%9 == j%9 || i/9 == j/9 ||( i/27 == j/27 && (i%9)/3 == (j%9)/3 ) ) && p[j] == m ){ break;} }
if( j == 81 ){
grid[i] = m; s( grid );
}}}


56 posted on 05/01/2008 12:24:56 AM PDT by dr_lew
[ Post Reply | Private Reply | To 55 | View Replies]

To: dr_lew

Actually, this can be tightened up a little bit by eliminating the duplication of the grid for each recursion, as this isn’t necessary. ( Of course, I cheated by doubling up the lines a little bit more. ) The recursion works its way up and down the grid, and can “cover its tracks” by resetting the spot its working on to ‘0’. This runs only slightly faster: 0.531 sec vs. 0.562 sec for this test case. I’m sure the C version of this “pure trial” algorithm runs faster as compiled object than the Python version does on its virtual machine, but how much faster, I don’t know. I would think that the Python version would be at least 5 times as slow, but I’m quite often wrong about this sort of thing.

main(argc,argv)int argc; char **argv;{ s(argv[1],0); }
s(p,i) char *p; int i; { int j; char m;
while( i<81 && p[i] != ‘0’) ++i; if( i == 81 ){ printf(”%.81s\n”,p); exit(0); }
for( m=’1’ ; m<=’9’ ; ++m ) { for( j=0 ; j<81 ; j++ )
if( ( i%9 == j%9 || i/9 == j/9 || ( i/27 == j/27 && (i%9)/3 == (j%9)/3 ) ) && p[j] == m )break;
if( j == 81 ){ p[i] = m; s( p, i+1 ); } } p[i]=’0’; }


57 posted on 05/01/2008 1:38:34 AM PDT by dr_lew
[ Post Reply | Private Reply | To 56 | View Replies]

To: dr_lew
I would think that the Python version would be at least 5 times as slow, but I’m quite often wrong about this sort of thing.

Yes, Python tends to be slow, but there is a Python "compiler" to C++ called ShedSkin that is slightly more rigid with types than Python. They report an 18x speedup with a slightly modified version of the original algorithm.

def r(a):
i=a.find('0')
if not ~i: print a; exit()
[m in [a[j] for j in range(81) if not
(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)] or r(a[:i]+m+a[i+1:]) for m in '3814697265625']
from sys import *;r(argv[1])

58 posted on 05/01/2008 7:50:21 AM PDT by dan1123 (If you want to find a person's true religion, ask them what makes them a "good person".)
[ Post Reply | Private Reply | To 57 | View Replies]

To: blam

I'm working on drawing one of these in 3DS. I can get the acanthus leaves but the scrolls present an array of challenges.

59 posted on 05/01/2008 8:05:25 AM PDT by Walmartian
[ Post Reply | Private Reply | To 1 | View Replies]

To: longun45

That’s a matter of maturity, not IQ.


60 posted on 05/01/2008 8:07:05 AM PDT by MrB (You can't reason people out of a position that they didn't use reason to get into in the first place)
[ Post Reply | Private Reply | To 4 | View Replies]


Navigation: use the links below to view more comments.
first previous 1-2021-4041-6061 next last

Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.

Free Republic
Browse · Search
News/Activism
Topics · Post Article

FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson