|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/markrose/mars/ |
Upload File : |
<HTML>
<HEAD><TITLE>SimGalaxy</TITLE>
<style>
h2
{color:#9C8900;}
h3
{color:#9C8900;}
h4
{color:#9C8900;}
h5
{color:#9C8900;}
h6
{color:#9C8900;}
</style>
<SCRIPT LANGUAGE="JavaScript" SRC="mars.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#F2EED1">
<form action="" name="theform">
<script language="javascript" type="text/javascript">
function makeRand(howMany)
{
return Math.floor((Math.random()*howMany)%howMany);
}
function settext(t)
{
document.getElementById("mytext").innerHTML = t;
}
function SomeRandom(value)
{
return value * (0.9 + Math.random() * 0.2);
}
function game()
{
// Get the user's parameters
var theform = document.theform;
var species = theform.species.value;
var planet = theform.planet.value;
var singularity = theform.singularity.checked;
var ftl = theform.ftl.checked;
var enemies = 0;
if (theform.n[1].checked) enemies = 3;
if (theform.n[2].checked) enemies = 5;
if (theform.n[3].checked) enemies = 8;
if (theform.n[4].checked) enemies = 16;
var gameplay = 0;
for (i=0;i<theform.goal.length;i++){
if (theform.goal[i].checked)
gameplay = i;
}
var gummint = 0;
for (i=0;i<theform.gummint.length;i++){
if (theform.gummint[i].checked)
gummint = i;
}
var core = 0;
for (i=0;i<theform.core.length;i++){
if (theform.core[i].checked)
core = i;
}
var edge = 0;
for (i=0;i<theform.edge.length;i++){
if (theform.edge[i].checked)
edge = i;
}
// Compute game progress
// Raw size
var size = 100 + (1000 / (enemies + 1));
if (gameplay < 2) size *= 1.5;
if (gameplay == 2) size *= 4;
if (gummint == 0) size *= 0.8;
if (ftl == true) size *= 5;
if (core == 0) size *= 1.5;
if (core == 1) size *= 1.25;
if (edge == 0) size *= 2;
if (edge == 1) size *= 1.25;
size = Math.floor(SomeRandom(size));
// Enemy size:
var esize = 0;
if (enemies > 0) {
var esize = 300 + (150 * enemies);
if (ftl == true) esize *= 5;
esize *= (1 + Math.random());
esize = Math.floor(esize);
}
// Warmaking potential
var war = (5 - gameplay);
if (gameplay == 3) war = 1.0;
if (gummint == 0) war *= 1.1;
if (gummint == 1) war *= 0.8;
if (gummint == 2) war *= 0.5;
if (gummint == 3) war *= 1.6;
if (core == 1) war *= 1.25;
if (core == 2) war *= 1.7;
if (core == 3) war *= 0.8;
if (edge == 1) war *= 1.25;
if (edge == 2) war *= 2.1;
if (edge == 3) war *= 0.7;
if (singularity) war *= 0.75;
// Enemy warmaking
var ewar = 0.0;
if (enemies > 0) {
ewar = 1.5 + (Math.random() * 4.0);
if (war < 4) ewar *= 1.25;
}
// Culture
var cult = 1.0;
if (gameplay == 2) cult *= 1.25;
if (gameplay == 3) cult *= 4;
if (gummint == 0) cult *= 0.6;
if (gummint == 1) cult *= 1.25;
if (gummint == 2) cult *= 1.52;
if (core == 1) cult *= 1.25;
if (core == 2) cult *= 0.75;
if (core == 3) cult *= 2;
if (edge == 1) cult *= 1.2;
if (edge == 2) cult *= 0.75;
if (edge == 3) cult *= 1.5;
if (singularity) cult *= 1.1;
// Punish incoherent choices
if (gameplay == 0 && cult > war) war *= 0.6;
if (gameplay == 3 && war > cult) cult *= 0.6;
war = Math.floor(war * 10) / 10;
ewar = Math.floor(ewar * 10) / 10;
cult = Math.floor(cult * 10) / 10;
// Evaluate wars
// Raw power = worlds * war potential
var power = Math.floor(size * war);
var epower = esize * ewar;
// Enemies waste time on each other
if (enemies == 3) epower *= 0.6;
if (enemies == 5) epower *= 0.4;
if (enemies == 8) epower *= 0.25;
if (enemies == 16) epower *= 0.1;
epower = Math.floor(epower);
// Conquests are a comparison of power
var conquests = 0;
var losses = 0;
var ratio = 1.0;
if (enemies > 0) {
ratio = power / epower;
var newsize = Math.floor(size * ratio);
if (newsize > size + esize) newsize = size + esize;
if (newsize > size) conquests = newsize - size;
else losses = size - newsize;
}
// Culture flips depend on energy, decrease with # enemies
var flips = 0;
var netsize = size + conquests - losses;
var enetsize = esize - conquests + losses;
if (enemies > 0 && cult > 1.0) {
var mult = (cult - 1) / 20;
if (enemies == 5) mult *= 0.9;
if (enemies == 8) mult *= 0.75;
if (enemies == 16) mult *= 0.5;
flips = enetsize * mult;
if (cult < 5 && flips > size)
flips = size * (0.5 + Math.random() * 0.5);
flips = Math.floor(flips);
netsize += flips;
enetsize -= flips;
}
// If our culture sucks, we can suffer flips
var badflips = 0;
if (enetsize * 2 > netsize && cult < 1.0) {
var potential = netsize * 0.5;
badflips = Math.floor(potential * (1 - cult));
netsize -= badflips;
enetsize += badflips;
}
var cultural = flips > conquests;
// Singularity?
var winsig = singularity
&& netsize > 100 && cult > 15 && war < 2.0
&& Math.random() > 0.5;
// Report results
s = "<table><tr><td></td><td><b>" + species + "</b></td>";
s += "<td><b>Aliens</b></td></tr>";
s += "<tr><td>Raw size (worlds):</td><td>"
+ size + "</td><td>"
+ esize + "</td></tr>";
s += "<tr><td>Culture:</td><td>"
+ cult + "</td><td></td></tr>";
s += "<tr><td>Warmaking potential:</td><td>"
+ war + "</td><td>"
+ ewar + "</td></tr>";
s += "<tr><td>Power:</td><td>"
+ power + "</td><td>"
+ epower + "</td></tr>";
if (enemies > 0) {
s += "<tr><td>Conquests (worlds):</td><td>";
if (losses > 0) {
s += "</td><td>" + losses + "</td></tr>";
} else {
s += conquests + "</td><td></td></tr>";
}
s += "<tr><td>Cultural conversions:</td><td>"
+ flips + "</td><td>" + badflips + "</td></tr>";
s += "<tr><td><b>Net size</b> (worlds)</td><td>"
+ netsize + "</td><td>" + enetsize + "</td></tr>";
}
s += "</table> <p><b>" + planet + " ";
if (winsig) {
s += "achieved the singularity!"
}
else if (enemies > 0) {
if (enetsize == 0) {
if (cultural)
s += "has converted the entire galaxy!"
else
s += "has conquered the entire galaxy!"
} else if (netsize > 10 * enetsize) {
if (cultural)
s += "has all but converted the entire galaxy!"
else
s += "has conquered almost the entire galaxy!"
} else if (netsize > enetsize * 2) {
if (cultural )
s += "is culturally dominant!"
else
s += "dominates the galaxy!"
} else if (netsize > enetsize) {
if (cultural)
s += "squeaks out a culture win!";
else
s += "wins on points!";
} else if (netsize == 0) {
s += "was conquered by slavering aliens!";
} else if (netsize < enetsize * 0.15) {
s += "ended up as a pitiful, pathetic sliver!";
} else if (netsize * 1.75 > enetsize) {
s += "is a strong minor power!";
} else {
s += "is a minor power!";
}
} else {
s += "may be ready to play with others!"
}
s += "</b>";
settext(s);
}
function leave()
{
window.location = pageref("apartment");
}
</script>
<h2>SimGalaxy</h2>
You fire up the datanode, slip on the inducer, and there you are hovering over a huge galaxy ripe for the exploiting!
<blockquote><table>
<tr>
<td>What is your species called?</td>
<td><input type="text" name="species" value="Humans">
</td></tr>
<tr>
<td>What is their main planet?</td>
<td>
<input type="text" name="planet" value="Mars">
</td></tr>
<tr>
<td>Number of species: </td>
<td>
<Input type ="radio" name="n" value="1">Just you
<Input type ="radio" name="n" value="3">3
<Input type ="radio" name="n" Value="5">5
<Input type ="radio" name="n" Value="8">8
<Input type ="radio" name="n" Value="16">16
</td></tr>
<tr>
<td>What's your overall play style? </td>
<td>
<Input type = "radio" name="goal" value="1">Eradicate
<Input type ="radio" name="goal" Value="2">Dominate
<Input type ="radio" name="goal" Value="3">Develop
<Input type ="radio" name="goal" Value="4">Enlighten
</td></tr>
<tr>
<td>Government preference:</td>
<td>
<Input type = "radio" name="gummint" value="1">Autarchy
<Input type ="radio" name="gummint" Value="2">Communitarian
<Input type ="radio" name="gummint" Value="3">Democracy
<Input type ="radio" name="gummint" Value="4">Ideological
</td></tr>
<tr>
<td>Enable Singularity? </td>
<td>
<Input type = "checkbox" name="singularity" value="unchecked">Yes
</td></tr>
<tr>
<td>Allow FTL travel? </td>
<td>
<Input type = "checkbox" name="ftl" value="unchecked">Yes
</td></tr>
<tr>
<td>Production orders for core: </td>
<td>
<Input type = "radio" name="core" value="1">Expansion
<Input type ="radio" name="core" Value="2">Money
<Input type ="radio" name="core" Value="3">Troops
<Input type ="radio" name="core" Value="4">Culture
</td></tr>
<tr>
<td>Production orders for periphery: </td>
<td>
<Input type = "radio" name="edge" value="1">Expansion
<Input type ="radio" name="edge" Value="2">Money
<Input type ="radio" name="edge" Value="3">Troops
<Input type ="radio" name="edge" Value="4">Culture
</td></tr>
</table></blockquote>
<center><input type="button" value="Play" onClick="game();"></center>
<p><center><input type="button" value="Done" onClick="leave();"></center>
<p><div id="mytext"> </div>
</form>
</body>
</html>