Student Support Forum: 'Colored checkerboard' topicStudent Support Forum > General > Archives > "Colored checkerboard"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response Bill Simpson 01/22/13 10:30pm I am assuming you mean you do not want two adjacent squares to have the same color. This generates a board of size*size and then checks to see that no two adjacent are the same number. If two adjacent are the same it generates a new board and tries again. In[1]:= size=2;count=0; While[True, t=Table[RandomInteger[3,{size,size}]; success=True;count++; For[i=1,i≤size,i++, For[j=1,j≤size,j++, If[i>1&&t[[i,j]]==t[[i-1,j]]|| i1&&t[[i,j]]==t[[i,j-1]]|| j

 Subject (listing for 'Colored checkerboard') Author Date Posted Colored checkerboard Savage 01/22/13 11:21am Re: Colored checkerboard Bill Simpson 01/22/13 10:30pm Re: Re: Colored checkerboard Savage 01/24/13 1:41pm Re: Re: Re: Colored checkerboard Bill Simpson 01/24/13 10:41pm Re: Colored checkerboard yehuda 01/23/13 06:46am Re: Colored checkerboard Bill Simpson 01/25/13 3:25pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic