112 lines
9.6 KiB
Plaintext
112 lines
9.6 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> STRENGTH_SCALE 1.5e7
|
||
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> SPRING_SCALE 6.0e6
|
||
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> COST_SCALE 375.0
|
||
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> MASS_RADIUS 3.0
|
||
|
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> MASS_MASS 10.0
|
||
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> WIRE_PERCENT 0.99
|
||
|
<a name="l7"></a>
|
||
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> RIVER_BANK_COLS 5
|
||
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> SKY_LINES 40
|
||
|
<a name="l10"></a>
|
||
|
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_X1 (</span><span class=cF7>(</span><span class=cF0>RIVER_BANK_COLS-1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>)
|
||
|
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_X2 (</span><span class=cF7>(</span><span class=cF0>RIVER_BANK_COLS-4</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>)
|
||
|
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_X3 (</span><span class=cF3>TEXT_COLS</span><span class=cF0>*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>>>1)
|
||
|
<a name="l14"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_Y1 (</span><span class=cF7>(</span><span class=cF0>SKY_LINES+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
|
||
|
<a name="l15"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_Y2 (</span><span class=cF7>(</span><span class=cF0>SKY_LINES+5</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
|
||
|
<a name="l16"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_Y3 (</span><span class=cF7>(</span><span class=cF3>TEXT_ROWS</span><span class=cF0>-8</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
|
||
|
<a name="l17"></a>
|
||
|
<a name="l18"></a>#</span><span class=cF1>define</span><span class=cF0> LOAD_WEIGHTS 8
|
||
|
<a name="l19"></a>
|
||
|
<a name="l20"></a></span><span class=cF1>U0</span><span class=cF0> SpanBridge1Init(</span><span class=cF9>CMathODE</span><span class=cF0> *)
|
||
|
<a name="l21"></a>{
|
||
|
<a name="l22"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||
|
<a name="l23"></a>
|
||
|
<a name="l24"></a> MyMass *tmpm;
|
||
|
<a name="l25"></a> tmpm=PlaceMass(</span><span class=cF3>GR_WIDTH</span><span class=cF0>-FIXED_X1,FIXED_Y1);
|
||
|
<a name="l26"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l27"></a> tmpm=PlaceMass(</span><span class=cF3>GR_WIDTH</span><span class=cF0>-FIXED_X2,FIXED_Y1);
|
||
|
<a name="l28"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l29"></a> tmpm=PlaceMass(</span><span class=cF3>GR_WIDTH</span><span class=cF0>-FIXED_X1,FIXED_Y2);
|
||
|
<a name="l30"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l31"></a> tmpm=PlaceMass(FIXED_X1,FIXED_Y1);
|
||
|
<a name="l32"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l33"></a> tmpm=PlaceMass(FIXED_X2,FIXED_Y1);
|
||
|
<a name="l34"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l35"></a> tmpm=PlaceMass(FIXED_X1,FIXED_Y2);
|
||
|
<a name="l36"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l37"></a> tmpm=PlaceMass(FIXED_X3,FIXED_Y3);
|
||
|
<a name="l38"></a> tmpm->flags|=</span><span class=cF3>MSF_FIXED</span><span class=cF0>;
|
||
|
<a name="l39"></a>
|
||
|
<a name="l40"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<LOAD_WEIGHTS;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l41"></a> tmpm=PlaceMass(FIXED_X1+</span><span class=cF7>(</span><span class=cF0>i+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>-2*FIXED_X1</span><span class=cF7>)</span><span class=cF0>/</span><span class=cF7>(</span><span class=cF0>LOAD_WEIGHTS+1</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l42"></a> FIXED_Y1);
|
||
|
<a name="l43"></a> tmpm->load_t=(i+1.0)/LOAD_WEIGHTS;
|
||
|
<a name="l44"></a> tmpm->color=</span><span class=cF3>RED</span><span class=cF0>;
|
||
|
<a name="l45"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l46"></a>
|
||
|
<a name="l47"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
||
|
<a name="l48"></a> </span><span class=cF6>"$BG,LTCYAN$%h*c"</span><span class=cF0>,SKY_LINES,</span><span class=cF6>'\n'</span><span class=cF0>;
|
||
|
<a name="l49"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<10;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l50"></a> </span><span class=cF6>"$BG,BROWN$%h*c"</span><span class=cF0>,RIVER_BANK_COLS,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l51"></a> </span><span class=cF6>"$BG,LTCYAN$%h*c"</span><span class=cF0>,</span><span class=cF3>TEXT_COLS</span><span class=cF0>-2*RIVER_BANK_COLS,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l52"></a> </span><span class=cF6>"$BG,BROWN$%h*c\n"</span><span class=cF0>,RIVER_BANK_COLS,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l54"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<5;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l55"></a> </span><span class=cF6>"$BG,BROWN$%h*c"</span><span class=cF0>,RIVER_BANK_COLS+i,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l56"></a> </span><span class=cF6>"$BG,BLUE$%h*c"</span><span class=cF0>,</span><span class=cF3>TEXT_COLS</span><span class=cF0>/2-RIVER_BANK_COLS-2*i,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l57"></a> </span><span class=cF6>"$BG,BROWN$%h*c"</span><span class=cF0>,2*i,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l58"></a> </span><span class=cF6>"$BG,BLUE$%h*c"</span><span class=cF0>,</span><span class=cF3>TEXT_COLS</span><span class=cF0>/2-RIVER_BANK_COLS-2*i,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l59"></a> </span><span class=cF6>"$BG,BROWN$%h*c\n"</span><span class=cF0>,RIVER_BANK_COLS+i,</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
||
|
<a name="l60"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l61"></a>}
|
||
|
<a name="l62"></a>
|
||
|
<a name="l63"></a></span><span class=cF1>U0</span><span class=cF0> AdjustLoads(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
|
||
|
<a name="l64"></a>{
|
||
|
<a name="l65"></a> MyMass *tmpm=ode->next_mass;
|
||
|
<a name="l66"></a> </span><span class=cF1>F64</span><span class=cF0> d,tt=SpanTime/10.0;
|
||
|
<a name="l67"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&ode->next_mass) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->load_t) {
|
||
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (tt) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l70"></a> d=</span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>tmpm->load_t*</span><span class=cF3>pi</span><span class=cF0>+tt</span><span class=cF7>)</span><span class=cF0>); </span><span class=cF2>//0.0<=d<=1.0</span><span class=cF0>
|
||
|
<a name="l71"></a> tmpm->mass=100.0*</span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>d+1.0</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l72"></a> tmpm->radius=7.0*d+2.0;
|
||
|
<a name="l73"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l74"></a> tmpm->mass=MASS_MASS;
|
||
|
<a name="l75"></a> tmpm->radius=MASS_RADIUS;
|
||
|
<a name="l76"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l77"></a> }
|
||
|
<a name="l78"></a> tmpm=tmpm->next;
|
||
|
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l80"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|