| 
 | 
     
    
    
    
     
    
    
    
 
    
    
 
    
     
    
    
    
     
    
    
    
     
    
    
    
 
    
    
 
    
    
 | 
       | 
      
 
 
	
		  | 
	
	 | 
 
 
		
	
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 03:48 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Major General 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Feb 2005 
					Location: Lake of Hali, Aldebaran, OH 
					
					
						Posts: 2,474
					 
					 
	Thanks: 51 
	
		
			
				Thanked 67 Times in 27 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		 I have a script that does that at home, I'll attach it when I get back from work. 
 
 Do you want to require anything of the four neighbours - like, they all have to be the same land/sea, or don't count wastelands, anything like that? 
		
	
		
		
		
		
		
		
			
				__________________ 
				If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 04:28 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Oct 2003 
					Location: Vacaville, CA, USA 
					
					
						Posts: 13,736
					 
					 
	Thanks: 341 
	
		
			
				Thanked 479 Times in 326 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		I would like them to be the same land/sea.  
Thanks for asking. 
 
edited: come to think of it. If its not too much bother Id rather nostart anyplace that would get stuck with neighbors of all the same bonuses.  
water: 3 or more water neighbors. 
land: 4 or more land neighbors. None of them water. And not all the same terrain (in other words refuse a mountain terrain surrounded by mountains or a swamp terrain surrounded by swamps 
 
Id like the water to be 4 or more water and no land neighbors but so far Im having trouble getting PHs mapgen to make oceans 
		
	
		
		
		
		
		
		
			
				__________________ 
				-- DISCLAIMER:  
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 04:43 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				National Security Advisor 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Oct 2003 
					Location: Helsinki, Finland 
					
					
						Posts: 5,425
					 
					 
	Thanks: 174 
	
		
			
				Thanked 695 Times in 267 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		Kaljamaha's script will output a text file that will tell you which province has how many neighbors, which provinces are startable and which are not and the output is tab-separated, so you can copy-paste it to a spreadsheet and examine at your leisure. It basically gives you a full bore terrain analysis and neighbor analysis out of a map file. 
		
	
		
		
		
		
		
		
			
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 04:54 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				General 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Feb 2007 
					Location: R'lyeh 
					
					
						Posts: 3,861
					 
					 
	Thanks: 144 
	
		
			
				Thanked 403 Times in 176 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		
	Quote: 
	
	
		
			
				Gandalf Parker said: I want to package up some of the wrapped maps from PH's map generator but I notice that it has no nostarts. Can I get something (basic, awk, sed, whatever) that will nostart any province with fewer than 4 neighbors?  
			
		 | 
	 
	 
 There are dozens of scripts for this...
 DireAussie has a web page which does this,  Jack has that aswell and with  source code available, too. There's a Python script in the  Urrapand map which does this, although it would have to be changed a little so that the map file name becomes a parameter instead of being hard-coded. Finally, DrP has a done a  perl script for this aswell.  
		
	
		
		
		
		
		
		
			
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 05:59 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Oct 2003 
					Location: Vacaville, CA, USA 
					
					
						Posts: 13,736
					 
					 
	Thanks: 341 
	
		
			
				Thanked 479 Times in 326 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		Great list.   
I think you will see my name in the credits of most of those. But Im hoping for something that will work in linux, text mode, and can be automated as much as possible.
 
DireAussies doesnt seem to work in lynx (text browser)
 
Jacks online version is great and does work in lynx (I was surprised). I hadnt realized that he had added starting provinces. But it would need to be done manually I think. I might do it for the great big maps that I plan to offer very few of.
 
Jacks code seems to be windowsy.
 
The python code in the urrapand map does actually look to be workable. Thanks for mentioning it.
 
DrP's code was the first one I tried and didnt seem to get a result. Im sure its a fluke with my system.
 
I had understood that Ballbarian did one also but I havent found it yet.
 
So far it looks like Urrapand's python code is my best bet  
		
	
		
		
		
		
		
		
			
				__________________ 
				-- DISCLAIMER:  
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 09:15 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Major General 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Feb 2005 
					Location: Lake of Hali, Aldebaran, OH 
					
					
						Posts: 2,474
					 
					 
	Thanks: 51 
	
		
			
				Thanked 67 Times in 27 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		 GP, this is the script I happened to have lying around - I can modify it to check that the neighbours have a diversity of bitmasks, but this might do your for your purposes. 
 
 Arguments are: 
* Minimum # of neighbors (same land/sea) 
* Minimum # of neighbors (same land/sea and NOT swamp, wasteland or deep sea) 
* Bitmask to apply to provinces that don't meet the criterion (presumably you want the bitmask for nostart but I forget what that is.) 
 
 Made some slight modifications, had a few beers after work can easily make other changes in the morning if this doesn't suit. 
 
 e.g.: 
$ perl GandStart.pl.txt 4 3 128 < 390mp_new.map 
		
	
		
		
		
		
		
		
			
				__________________ 
				If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 10:35 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Oct 2003 
					Location: Vacaville, CA, USA 
					
					
						Posts: 13,736
					 
					 
	Thanks: 341 
	
		
			
				Thanked 479 Times in 326 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		DrP, I get an error trying to grab that file. 
		
	
		
		
		
		
		
		
			
				__________________ 
				-- DISCLAIMER:  
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 1st, 2007, 11:20 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Major General 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Feb 2005 
					Location: Lake of Hali, Aldebaran, OH 
					
					
						Posts: 2,474
					 
					 
	Thanks: 51 
	
		
			
				Thanked 67 Times in 27 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		 Weird. 
 Well, it's not long.
 Code:
  
#!/usr/bin/perl 
 
#Arguments are - 
# minimum # of neighbors, not counting non-matching. 
# minimum # of neighbours, not counting non-matching, wasteland, deep sea or swamp 
# bitmask you want to apply. 
 
$d_neigh = $ARGV[0]; 
$d_neigh2 = $ARGV[1]; 
$apply = $ARGV[2]; 
$forced = 0; 
 
while (<STDIN>) 
{ 
	chomp $_; 
	@line = split (/ /);  
	$pmode = 1; 
 
	if (/^#terrain/){ 
		$terrain[$line[1]] = $line[2]; 
		if ($line[2] % 8 >= 4){ 
			$type[$line[1]] = -1; 
		} 
		else { 
			$type[$line[1]] = 1; 
		} 
		$cool[$line[1]] = $type[$line[1]]; 
		if ($line[2] % 128 >= 64 || $line[2] % 64 >= 32 || $line[2] % 4096 >= 2048){ 
			$elig[$line[1]] = 2; 
		} 
		# Upshot 
		#  - implies sea. 
		#  + implies land. 
		#  2 implies a wasteland, swamp or deep sea. 
 
		$mask[$line[1]] = $line[2]; 
		if ($line[1] > $numprov){$numprov = $line[1];} 
		$pmode = 0; 
	} 
 
	if (/^#neighbour/){ 
		$adj{$line[1]}{$line[2]} = 1;			 
		$adj{$line[2]}{$line[1]} = 1;			 
	} 
 
	if ($pmode == 1){ 
		print "$_\n"; 
	} 
} 
 
# Okay, now we need to know which provinces are eligible start-sites. 
for ($i = 1; $i <= $numprov; $i++){ 
	$total = 0; $same = 0; $bad = 0; 
	for $j (keys %{$adj{$i}}){ 
		if ($cool[$i] * $cool[$i] == 1) {$same++;} 
		if ($cool[$i] * $cool[$j] * $elig[$j] == 2) {$bad++;} 
		$total++; 
	} 
#	print "$i,$elig\n"; 
 
	if ($same == 0 && $type[$i] == -1){print "-- $i is a single province lake!\n";}  
	if ($same == 0 && $type[$i] == 0){print "-- $i is a single province island!\n";}  
	if ($total == 0){print "-- $i is an isolated province!\n";} 
	if ($same < $d_neigh){$mask[$i] = $mask[$i] | $apply;} 
	if ($same - $bad < $d_neigh2){$mask[$i] = $mask[$i] | $apply;} 
	print "#terrain $i $mask[$i]\n"; 
}  
 
  
		
	
		
		
		
		
		
		
			
				__________________ 
				If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				May 2nd, 2007, 12:22 AM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Oct 2003 
					Location: Vacaville, CA, USA 
					
					
						Posts: 13,736
					 
					 
	Thanks: 341 
	
		
			
				Thanked 479 Times in 326 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: tool request (terrain math)
			 
             
			
		
		
		
		That works great. Thanks.    
		
	
		
		
		
		
		
		
			
				__________________ 
				-- DISCLAIMER:  
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
 
	
		
	
	
	
	
	
	
	| Thread Tools | 
	
 
	| 
	
	
	
	 | 
	
 
	| Display Modes | 
	
 
	
	
	
	
		  Linear Mode 
		
		
	 
	
	 | 
	
	
 
 
	
		
	
		 
		Posting Rules
	 | 
 
	
		
		You may not post new threads 
		You may not post replies 
		You may not post attachments 
		You may not edit your posts 
		 
		
		
		
		
		HTML code is On 
		 
		
	  | 
 
 
	 | 
	
		
	 | 
 
 
     |  
 |