Puzzle code... 
	 
	
		| Author | 
		Message | 
	 
		 
		jcollins1991
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 25, 2010 8:15 am    Post subject: Puzzle code...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Was bored awhile ago so I wrote a program to solve one of the facebook puzzles ("smallworld")... Unfortunately they don't accept Scheme code so I can't submit it, so I've decided to post it here instead XD, since it's not a working submission it I'm hoping it won't matter...
 
 
It's a fairly simple solution, whenever you want to add someone just go through and insert them into each persons list of 3 closest friends, then at the end find the 3 closest friends of the person you're adding... Some variables are reused so it might be a bit hard to read (dist is a function then a value >.<...), but I've quickly commented so hopefully it'll be partially readable... BTW, I know it works for the test case they give, but I haven't really checked for other cases, though it should still work...
 
 
edit: looks like I can't upload *.ss files, so I changed it to .txt, just change it back to run it...
		
	
  
          
							 
	
	
		
	 
	
		|  Description: | 
		
			
		 | 
		  Download | 
	 
	
		|  Filename: | 
		 smallworld.txt | 
	 
	
		|  Filesize: | 
		 2.89 KB | 
	 
	
		|  Downloaded: | 
		 390 Time(s) | 
	 
	 
	 
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |