All pastes #513229 Raw Edit

Someone

public php v1 · immutable
#513229 ·published 2007-05-27 05:18 UTC
rendered paste body
<?php  /* mines not functioned because you said no functions allowed lier. */?><html>	<head>		<title>Challenge!</title>		<style>			table { table-layout: fixed; }			td { font-size: 0px; width: 10px !important; height: 10px; }		</style>	</head>	<body><?php	/**	 * 0,0                  1,0	 * 	 * 	 * 	 * 	 * 	 * 	 * 	 * 	 * 0,1	 *	 * @param int $x	 * @param int $y	 * 	 * distance = sqrt((x2-x1)^2 + (y2-y1)^2)	 * 	 * abs((actual - goal)/goal)	 * 	 * get the distance to the point	 * find out what perctange it is of the max distance	 * multiply that perctange times the color	 */	$x = 32;	$y = 32;	// linear	/*	echo "<table border=0 cellpadding=0 cellspacing=0>";				echo "<tr>";		for($i = 0; $i < $x; $i++) {			$dist = $i - 0; // (simple)			$p = abs( ($dist - $x) / $x ); // (simple)			$color = dechex( 255 * $p );			//echo "$dist, $p, $color\n";			echo "<td style='background-color: #00{$color}00'>&nbsp;</td>";		}		echo "</tr>";			echo "</table>";	*/	echo "<table border=0 cellpadding=0 cellspacing=0>";	$goal = sqrt(pow($x,2) + pow($y,2));	for($h = 0; $h < $y; $h++) {		echo "<tr>";		for($i = 0; $i < $x; $i++) {			$plus = pow($i,2) + pow($h,2);			$dist = sqrt( pow($i,2) + pow($h,2) ); // (simple)			$p = abs( ($dist - $goal) / $goal ); // (simple)			$color = str_pad(dechex( 255 * $p ), 2, '0', STR_PAD_LEFT);			//echo "($i, $h) $plus : $dist vs $goal, $p, $color\n";			echo "<td style='background-color: #00{$color}00'>&nbsp;</td>";		}		echo "</tr>";	}	echo "</table>";?>	</body></html>