GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • All gists
  • Back to GitHub
  • Sign in
  • Sign up
  • Code
  • Revisions 1
  • Terms
  • Privacy
  • Security
  • Status
  • Community
  • Docs
  • Contact

This view

  • Original page
  • New address

GeezerVison is showing gist.github.com — CAL procedure with if sequences

Instantly share code, notes, and snippets.

@robstewart57

robstewart57/my-actor.cal

Created February 28, 2015 00:50
Show Gist options
  • Download ZIP
  • Star 0 (0) You must be signed in to star a gist
  • Fork 0 (0) You must be signed in to fork a gist
  • Clone this repository at <script src="https://gist.github.com/robstewart57/436cb0fb0dfd880a4c01.js"></script>
  • Save robstewart57/436cb0fb0dfd880a4c01 to your computer and use it in GitHub Desktop.
Clone this repository at <script src="https://gist.github.com/robstewart57/436cb0fb0dfd880a4c01.js"></script>
Save robstewart57/436cb0fb0dfd880a4c01 to your computer and use it in GitHub Desktop.
Download ZIP
CAL procedure with if sequences
Raw
my-actor.cal
actor ProcedureUseActor() int In ==> int Out :
int val;
action In:[x] ==> Out:[out]
var int out
do
sqrtLookup(x);
out := val;
end
procedure sqrtLookup(int x) begin
if (x >= 1 && x <= 2) then val := 1;
else
if (x >= 3 && x <= 6) then val := 2;
else
if (x >= 7 && x <= 12) then val := 3;
else
if (x >= 13 && x <= 20) then val := 4;
else
if (x >= 21 && x <= 30) then val := 5;
else
if (x >= 31 && x <= 42) then val := 6;
else
if (x >= 43 && x <= 56) then val := 7;
else
if (x >= 57 && x <= 72) then val := 8;
else
if (x >= 73 && x <= 90) then val := 9;
else
if (x >= 91 && x <= 110) then val := 10;
else
if (x >= 111 && x <= 132) then val := 11;
else
if (x >= 133 && x <= 156) then val := 12;
else
if (x >= 157 && x <= 182) then val := 13;
else
if (x >= 183 && x <= 210) then val := 14;
else
if (x >= 211 && x <= 240) then val := 15;
else
if (x >= 241 && x <= 272) then val := 16;
else
if (x >= 273 && x <= 306) then val := 17;
else
if (x >= 307 && x <= 342) then val := 18;
else
if (x >= 343 && x <= 380) then val := 19;
else
if (x >= 381 && x <= 420) then val := 20;
else
if (x >= 421 && x <= 462) then val := 21;
else
if (x >= 463 && x <= 506) then val := 22;
else
if (x >= 507 && x <= 552) then val := 23;
else
if (x >= 553 && x <= 600) then val := 24;
else
if (x >= 601 && x <= 650) then val := 25;
else
if (x >= 651 && x <= 702) then val := 26;
else
if (x >= 703 && x <= 756) then val := 27;
else
if (x >= 757 && x <= 812) then val := 28;
else
if (x >= 813 && x <= 870) then val := 29;
else
if (x >= 871 && x <= 930) then val := 30;
else
if (x >= 931 && x <= 992) then val := 31;
else
if (x >= 993 && x <= 1056) then val := 32;
else
if (x >= 1057 && x <= 1122) then val := 33;
else
if (x >= 1123 && x <= 1190) then val := 34;
else
if (x >= 1191 && x <= 1260) then val := 35;
else
if (x >= 1261 && x <= 1332) then val := 36;
else
if (x >= 1333 && x <= 1406) then val := 37;
else
if (x >= 1407 && x <= 1482) then val := 38;
else
if (x >= 1483 && x <= 1560) then val := 39;
else
if (x >= 1561 && x <= 1640) then val := 40;
else
if (x >= 1641 && x <= 1722) then val := 41;
else
if (x >= 1723 && x <= 1806) then val := 42;
else
if (x >= 1807 && x <= 1892) then val := 43;
else
if (x >= 1893 && x <= 1980) then val := 44;
else
if (x >= 1981 && x <= 2070) then val := 45;
else
if (x >= 2071 && x <= 2162) then val := 46;
else
if (x >= 2163 && x <= 2256) then val := 47;
else
if (x >= 2257 && x <= 2352) then val := 48;
else
if (x >= 2353 && x <= 2450) then val := 49;
else
if (x >= 2451 && x <= 2550) then val := 50;
else
if (x >= 2551 && x <= 2652) then val := 51;
else
if (x >= 2653 && x <= 2756) then val := 52;
else
if (x >= 2757 && x <= 2862) then val := 53;
else
if (x >= 2863 && x <= 2970) then val := 54;
else
if (x >= 2971 && x <= 3080) then val := 55;
else
if (x >= 3081 && x <= 3192) then val := 56;
else
if (x >= 3193 && x <= 3306) then val := 57;
else
if (x >= 3307 && x <= 3422) then val := 58;
else
if (x >= 3423 && x <= 3540) then val := 59;
else
if (x >= 3541 && x <= 3660) then val := 60;
else
if (x >= 3661 && x <= 3782) then val := 61;
else
if (x >= 3783 && x <= 3906) then val := 62;
else
if (x >= 3907 && x <= 4032) then val := 63;
else
if (x >= 4033 && x <= 4160) then val := 64;
else
if (x >= 4161 && x <= 4290) then val := 65;
else
if (x >= 4291 && x <= 4422) then val := 66;
else
if (x >= 4423 && x <= 4556) then val := 67;
else
if (x >= 4557 && x <= 4692) then val := 68;
else
if (x >= 4693 && x <= 4830) then val := 69;
else
if (x >= 4831 && x <= 4970) then val := 70;
else
if (x >= 4971 && x <= 5112) then val := 71;
else
if (x >= 5113 && x <= 5256) then val := 72;
else
if (x >= 5257 && x <= 5402) then val := 73;
else
if (x >= 5403 && x <= 5550) then val := 74;
else
if (x >= 5551 && x <= 5700) then val := 75;
else
if (x >= 5701 && x <= 5852) then val := 76;
else
if (x >= 5853 && x <= 6006) then val := 77;
else
if (x >= 6007 && x <= 6162) then val := 78;
else
if (x >= 6163 && x <= 6320) then val := 79;
else
if (x >= 6321 && x <= 6480) then val := 80;
else
if (x >= 6481 && x <= 6642) then val := 81;
else
if (x >= 6643 && x <= 6806) then val := 82;
else
if (x >= 6807 && x <= 6972) then val := 83;
else
if (x >= 6973 && x <= 7140) then val := 84;
else
if (x >= 7141 && x <= 7310) then val := 85;
else
if (x >= 7311 && x <= 7482) then val := 86;
else
if (x >= 7483 && x <= 7656) then val := 87;
else
if (x >= 7657 && x <= 7832) then val := 88;
else
if (x >= 7833 && x <= 8010) then val := 89;
else
if (x >= 8011 && x <= 8190) then val := 90;
else
if (x >= 8191 && x <= 8372) then val := 91;
else
if (x >= 8373 && x <= 8556) then val := 92;
else
if (x >= 8557 && x <= 8742) then val := 93;
else
if (x >= 8743 && x <= 8930) then val := 94;
else
if (x >= 8931 && x <= 9120) then val := 95;
else
if (x >= 9121 && x <= 9312) then val := 96;
else
if (x >= 9313 && x <= 9506) then val := 97;
else
if (x >= 9507 && x <= 9702) then val := 98;
else
if (x >= 9703 && x <= 9900) then val := 99;
else
if (x >= 9901 && x <= 10100) then val := 100;
else
if (x >= 10101 && x <= 10302) then val := 101;
else
if (x >= 10303 && x <= 10506) then val := 102;
else
if (x >= 10507 && x <= 10712) then val := 103;
else
if (x >= 10713 && x <= 10920) then val := 104;
else
if (x >= 10921 && x <= 11130) then val := 105;
else
if (x >= 11131 && x <= 11342) then val := 106;
else
if (x >= 11343 && x <= 11556) then val := 107;
else
if (x >= 11557 && x <= 11772) then val := 108;
else
if (x >= 11773 && x <= 11990) then val := 109;
else
if (x >= 11991 && x <= 12210) then val := 110;
else
if (x >= 12211 && x <= 12432) then val := 111;
else
if (x >= 12433 && x <= 12656) then val := 112;
else
if (x >= 12657 && x <= 12882) then val := 113;
else
if (x >= 12883 && x <= 13110) then val := 114;
else
if (x >= 13111 && x <= 13340) then val := 115;
else
if (x >= 13341 && x <= 13572) then val := 116;
else
if (x >= 13573 && x <= 13806) then val := 117;
else
if (x >= 13807 && x <= 14042) then val := 118;
else
if (x >= 14043 && x <= 14280) then val := 119;
else
if (x >= 14281 && x <= 14520) then val := 120;
else
if (x >= 14521 && x <= 14762) then val := 121;
else
if (x >= 14763 && x <= 15006) then val := 122;
else
if (x >= 15007 && x <= 15252) then val := 123;
else
if (x >= 15253 && x <= 15500) then val := 124;
else
if (x >= 15501 && x <= 15750) then val := 125;
else
if (x >= 15751 && x <= 16002) then val := 126;
else
if (x >= 16003 && x <= 16256) then val := 127;
else
if (x >= 16257 && x <= 16512) then val := 128;
else
if (x >= 16513 && x <= 16770) then val := 129;
else
if (x >= 16771 && x <= 17030) then val := 130;
else
if (x >= 17031 && x <= 17292) then val := 131;
else
if (x >= 17293 && x <= 17556) then val := 132;
else
if (x >= 17557 && x <= 17822) then val := 133;
else
if (x >= 17823 && x <= 18090) then val := 134;
else
if (x >= 18091 && x <= 18360) then val := 135;
else
if (x >= 18361 && x <= 18632) then val := 136;
else
if (x >= 18633 && x <= 18906) then val := 137;
else
if (x >= 18907 && x <= 19182) then val := 138;
else
if (x >= 19183 && x <= 19460) then val := 139;
else
if (x >= 19461 && x <= 19740) then val := 140;
else
if (x >= 19741 && x <= 20000) then val := 141;
else
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.