LDDestroier

CC Periodic Table of Elements

May 31st, 2016
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.99 KB | None | 0 0
  1. -- pastebin get vxLQ1fVb element
  2. -- std pb vxLQ1fVb element
  3.  
  4. local scr_x, scr_y = term.getSize()
  5. -- for state, 1=gas, 2=liquid, 3=solid
  6. elements = {
  7.     [1] = {
  8.         name = "hydrogen",
  9.         symbol = "H",
  10.         mass = 1.008,
  11.         group = 1,
  12.         period = 1,
  13.         state = 1,
  14.         eleconfig = "",
  15.     },
  16.     [2] = {
  17.         name = "helium",
  18.         symbol = "He",
  19.         mass = 4.002602,
  20.         group = 18,
  21.         period = 1,
  22.         state = 1,
  23.         eleconfig = "",
  24.     },
  25.     [3] = {
  26.         name = "lithium",
  27.         symbol = "Li",
  28.         mass = 6.94,
  29.         group = 1,
  30.         period = 2,
  31.         state = 3,
  32.         eleconfig = "",
  33.     },
  34.     [4] = {
  35.         name = "beryllium",
  36.         symbol = "Be",
  37.         mass = 9.0121831,
  38.         group = 2,
  39.         period = 2,
  40.         state = 3,
  41.         eleconfig = "",
  42.     },
  43.     [5] = {
  44.         name = "boron",
  45.         symbol = "B",
  46.         mass = 10.81,
  47.         group = 13,
  48.         period = 2,
  49.         state = 3,
  50.         eleconfig = "",
  51.     },
  52.     [6] = {
  53.         name = "carbon",
  54.         symbol = "C",
  55.         mass = 12.011,
  56.         group = 14,
  57.         period = 2,
  58.         state = 3,
  59.         eleconfig = "",
  60.     },
  61.     [7] = {
  62.         name = "nitrogen",
  63.         symbol = "N",
  64.         mass = 14.007,
  65.         group = 15,
  66.         period = 2,
  67.         state = 1,
  68.         eleconfig = "",
  69.     },
  70.     [8] = {
  71.         name = "oxygen",
  72.         symbol = "O",
  73.         mass = 15.999,
  74.         group = 16,
  75.         period = 2,
  76.         state = 1,
  77.         eleconfig = "",
  78.     },
  79.     [9] = {
  80.         name = "fluorine",
  81.         symbol = "F",
  82.         mass = 18.998403163,
  83.         group = 17,
  84.         period = 2,
  85.         state = 1,
  86.         eleconfig = "",
  87.     },
  88.     [10] = {
  89.         name = "neon",
  90.         symbol = "Ne",
  91.         mass = 20.1797,
  92.         group = 18,
  93.         period = 2,
  94.         state = 1,
  95.         eleconfig = "",
  96.     },
  97.     [11] = {
  98.         name = "sodium",
  99.         symbol = "Na",
  100.         mass = 22.98976928,
  101.         group = 1,
  102.         period = 3,
  103.         state = 3,
  104.         eleconfig = "",
  105.     },
  106.     [12] = {
  107.         name = "magnesium",
  108.         symbol = "Mg",
  109.         mass = 24.305,
  110.         group = 2,
  111.         period = 3,
  112.         state = 3,
  113.         eleconfig = "",
  114.     },
  115.     [13] = {
  116.         name = "aluminum",
  117.         symbol = "Al",
  118.         mass = 26.9815385,
  119.         group = 13,
  120.         period = 3,
  121.         state = 3,
  122.         eleconfig = "",
  123.     },
  124.     [14] = {
  125.         name = "silicon",
  126.         symbol = "Si",
  127.         mass = 28.085,
  128.         group = 14,
  129.         period = 3,
  130.         state = 3,
  131.         eleconfig = "",
  132.     },
  133.     [15] = {
  134.         name = "phosphorus",
  135.         symbol = "P",
  136.         mass = 30.973761998,
  137.         group = 15,
  138.         period = 3,
  139.         state = 3,
  140.         eleconfig = "",
  141.     },
  142.     [16] = {
  143.         name = "sulfur",
  144.         symbol = "S",
  145.         mass = 32.06,
  146.         group = 16,
  147.         period = 3,
  148.         state = 3,
  149.         eleconfig = "",
  150.     },
  151.     [17] = {
  152.         name = "chlorine",
  153.         symbol = "Cl",
  154.         mass = 35.45,
  155.         group = 17,
  156.         period = 3,
  157.         state = 1,
  158.         eleconfig = "",
  159.     },
  160.     [18] = {
  161.         name = "argon",
  162.         symbol = "Ar",
  163.         mass = 39.945,
  164.         group = 18,
  165.         period = 3,
  166.         state = 1,
  167.         eleconfig = "",
  168.     },
  169.     [19] = {
  170.         name = "potassium",
  171.         symbol = "K",
  172.         mass = 39.0953,
  173.         group = 1,
  174.         period = 4,
  175.         state = 3,
  176.         eleconfig = "",
  177.     },
  178.     [20] = {
  179.         name = "calcium",
  180.         symbol = "Ca",
  181.         mass = 40.075,
  182.         group = 2,
  183.         period = 4,
  184.         state = 3,
  185.         eleconfig = "",
  186.     },
  187.     [21] = {
  188.         name = "scandium",
  189.         symbol = "Sc",
  190.         mass = 44.955905,
  191.         group = 3,
  192.         period = 4,
  193.         state = 3,
  194.         eleconfig = "",
  195.     },
  196.     [22] = {
  197.         name = "titanium",
  198.         symbol = "Ti",
  199.         mass = 47.587,
  200.         group = 4,
  201.         period = 4,
  202.         state = 3,
  203.         eleconfig = "",
  204.     },
  205.     [23] = {
  206.         name = "vanadium",
  207.         symbol = "V",
  208.         mass = 50.9,
  209.         group = 5,
  210.         period = 4,
  211.         state = 3,
  212.         eleconfig = "",
  213.     },
  214.     [24] = {
  215.         name = "chromium",
  216.         symbol = "Cr",
  217.         mass = 51.9961,
  218.         group = 6,
  219.         period = 4,
  220.         state = 3,
  221.         eleconfig = "",
  222.     },
  223.     [25] = {
  224.         name = "manganese",
  225.         symbol = "Mn",
  226.         mass = 54.938044,
  227.         group = 7,
  228.         period = 4,
  229.         state = 3,
  230.         eleconfig = "",
  231.     },
  232.     [26] = {
  233.         name = "iron",
  234.         symbol = "Fe",
  235.         mass = 55.845,
  236.         group = 8,
  237.         period = 4,
  238.         state = 3,
  239.         eleconfig = "",
  240.     },
  241.     [27] = {
  242.         name = "cobalt",
  243.         symbol = "Co",
  244.         mass = 58.933194,
  245.         group = 9,
  246.         period = 4,
  247.         state = 3,
  248.         eleconfig = "",
  249.     },
  250.     [28] = {
  251.         name = "nickel",
  252.         symbol = "Ni",
  253.         mass = 58.6934,
  254.         group = 10,
  255.         period = 4,
  256.         state = 3,
  257.         eleconfig = "",
  258.     },
  259.     [29] = {
  260.         name = "copper",
  261.         symbol = "Cu",
  262.         mass = 63.546,
  263.         group = 11,
  264.         period = 4,
  265.         state = 3,
  266.         eleconfig = "",
  267.     },
  268.     [30] = {
  269.         name = "zinc",
  270.         symbol = "Zn",
  271.         mass = 65.38,
  272.         group = 12,
  273.         period = 4,
  274.         state = 3,
  275.         eleconfig = "",
  276.     },
  277.     [31] = {
  278.         name = "gallium",
  279.         symbol = "Ga",
  280.         mass = 69.723,
  281.         group = 13,
  282.         period = 4,
  283.         state = 3,
  284.         eleconfig = "",
  285.     },
  286.     [32] = {
  287.         name = "germanium",
  288.         symbol = "Ge",
  289.         mass = 72.63,
  290.         group = 14,
  291.         period = 4,
  292.         state = 3,
  293.         eleconfig = "",
  294.     },
  295.     [33] = {
  296.         name = "arsenic",
  297.         symbol = "As",
  298.         mass = 74.921595,
  299.         group = 15,
  300.         period = 4,
  301.         state = 3,
  302.         eleconfig = "",
  303.     },
  304.     [34] = {
  305.         name = "selenium",
  306.         symbol = "Se",
  307.         mass = 78.971,
  308.         group = 16,
  309.         period = 4,
  310.         state = 3,
  311.         eleconfig = "",
  312.     },
  313.     [35] = {
  314.         name = "bromine",
  315.         symbol = "Br",
  316.         mass = 79.904,
  317.         group = 17,
  318.         period = 4,
  319.         state = 2,
  320.         eleconfig = "",
  321.     },
  322.     [36] = {
  323.         name = "krypton",
  324.         symbol = "Kr",
  325.         mass = 83.798,
  326.         group = 18,
  327.         period = 4,
  328.         state = 1,
  329.         eleconfig = "",
  330.     },
  331.     [37] = {
  332.         name = "rubidium",
  333.         symbol = "Rb",
  334.         mass = 85.4678,
  335.         group = 1,
  336.         period = 5,
  337.         state = 1,
  338.         eleconfig = "",
  339.     },
  340.     [38] = {
  341.         name = "strontium",
  342.         symbol = "Sr",
  343.         mass = 87.62,
  344.         group = 2,
  345.         period = 5,
  346.         state = 3,
  347.         eleconfig = "",
  348.     },
  349.     [39] = {
  350.         name = "yttrium",
  351.         symbol = "Y",
  352.         mass = 88.90584,
  353.         group = 3,
  354.         period = 5,
  355.         state = 3,
  356.         eleconfig = "",
  357.     },
  358.     [40] = {
  359.         name = "zirconium",
  360.         symbol = "Zr",
  361.         mass = 91.224,
  362.         group = 4,
  363.         period = 5,
  364.         state = 3,
  365.         eleconfig = "",
  366.     },
  367.     [41] = {
  368.         name = "niobium",
  369.         symbol = "Nb",
  370.         mass = 92.90637,
  371.         group = 5,
  372.         period = 5,
  373.         state = 3,
  374.         eleconfig = "",
  375.     },
  376.     [42] = {
  377.         name = "molybdenum",
  378.         symbol = "Mo",
  379.         mass = 95.95,
  380.         group = 6,
  381.         period = 5,
  382.         state = 3,
  383.         eleconfig = "",
  384.     },
  385.     [43] = {
  386.         name = "technetium",
  387.         symbol = "Tc",
  388.         mass = 98,
  389.         group = 7,
  390.         period = 5,
  391.         state = 3,
  392.         eleconfig = "",
  393.     },
  394.     [44] = {
  395.         name = "ruthenium",
  396.         symbol = "Ru",
  397.         mass = 101.07,
  398.         group = 8,
  399.         period = 5,
  400.         state = 3,
  401.         eleconfig = "",
  402.     },
  403.     [45] = {
  404.         name = "rhodium",
  405.         symbol = "Rh",
  406.         mass = 102.9055,
  407.         group = 9,
  408.         period = 5,
  409.         state = 3,
  410.         eleconfig = "",
  411.     },
  412.     [46] = {
  413.         name = "palladium",
  414.         symbol = "Pd",
  415.         mass = 106.42,
  416.         group = 10,
  417.         period = 5,
  418.         state = 3,
  419.         eleconfig = "",
  420.     },
  421.     [47] = {
  422.         name = "silver",
  423.         symbol = "Ag",
  424.         mass = 107.8682,
  425.         group = 11,
  426.         period = 5,
  427.         state = 3,
  428.         eleconfig = "",
  429.     },
  430.     [48] = {
  431.         name = "cadmium",
  432.         symbol = "Cd",
  433.         mass = 112.414,
  434.         group = 12,
  435.         period = 5,
  436.         state = 3,
  437.         eleconfig = "",
  438.     },
  439.     [49] = {
  440.         name = "indium",
  441.         symbol = "In",
  442.         mass = 114.818,
  443.         group = 13,
  444.         period = 5,
  445.         state = 3,
  446.         eleconfig = "",
  447.     },
  448.     [50] = {
  449.         name = "tin",
  450.         symbol = "Sn",
  451.         mass = 118.710,
  452.         group = 14,
  453.         period = 5,
  454.         state = 3,
  455.         eleconfig = "",
  456.     },
  457.     [51] = {
  458.         name = "antimony",
  459.         symbol = "Sb",
  460.         mass = 121.760,
  461.         group = 15,
  462.         period = 5,
  463.         state = 3,
  464.         eleconfig = "",
  465.     },
  466.     [52] = {
  467.         name = "tellurium",
  468.         symbol = "Te",
  469.         mass = 127.6,
  470.         group = 16,
  471.         period = 5,
  472.         state = 3,
  473.         eleconfig = "",
  474.     },
  475.     [53] = {
  476.         name = "iodine",
  477.         symbol = "I",
  478.         mass = 126.90447,
  479.         group = 17,
  480.         period = 5,
  481.         state = 3,
  482.         eleconfig = "",
  483.     },
  484.     [54] = {
  485.         name = "xenon",
  486.         symbol = "Xe",
  487.         mass = 131.293,
  488.         group = 18,
  489.         period = 5,
  490.         state = 1,
  491.         eleconfig = "",
  492.     },
  493.     [55] = {
  494.         name = "cesium",
  495.         symbol = "Cs",
  496.         mass = 132.90545196,
  497.         group = 1,
  498.         period = 6,
  499.         state = 3,
  500.         eleconfig = "",
  501.     },
  502.     [56] = {
  503.         name = "barium",
  504.         symbol = "Ba",
  505.         mass = 137.327,
  506.         group = 2,
  507.         period = 6,
  508.         state = 3,
  509.         eleconfig = "",
  510.     },
  511.     [57] = {
  512.         name = "lanthanum",
  513.         symbol = "La",
  514.         mass = 138.90547,
  515.         group = 4,
  516.         period = 9,
  517.         state = 3,
  518.         eleconfig = "",
  519.     },
  520.     [58] = {
  521.         name = "cerium",
  522.         symbol = "Ce",
  523.         mass = 140.116,
  524.         group = 5,
  525.         period = 9,
  526.         state = 3,
  527.         eleconfig = "",
  528.     },
  529.     [59] = {
  530.         name = "praseodymium ",
  531.         symbol = "Pr",
  532.         mass = 140.90766,
  533.         group = 6,
  534.         period = 9,
  535.         state = 3,
  536.         eleconfig = "",
  537.     },
  538.     [60] = {
  539.         name = "neodymium",
  540.         symbol = "Nd",
  541.         mass = 144.242,
  542.         group = 7,
  543.         period = 9,
  544.         state = 3,
  545.         eleconfig = "",
  546.     },
  547.     [61] = {
  548.         name = "promethium",
  549.         symbol = "Pm",
  550.         mass = 145,
  551.         group = 8,
  552.         period = 9,
  553.         state = 3,
  554.         eleconfig = "",
  555.     },
  556.     [62] = {
  557.         name = "samarium",
  558.         symbol = "Sm",
  559.         mass = 150.36,
  560.         group = 9,
  561.         period = 9,
  562.         state = 3,
  563.         eleconfig = "",
  564.     },
  565.     [63] = {
  566.         name = "europium",
  567.         symbol = "Eu",
  568.         mass = 151.964,
  569.         group = 10,
  570.         period = 9,
  571.         state = 3,
  572.         eleconfig = "",
  573.     },
  574.     [64] = {
  575.         name = "gadolinium",
  576.         symbol = "Gd",
  577.         mass = 157.25,
  578.         group = 11,
  579.         period = 9,
  580.         state = 3,
  581.         eleconfig = "",
  582.     },
  583.     [65] = {
  584.         name = "terbium",
  585.         symbol = "Tb",
  586.         mass = 158.92535,
  587.         group = 12,
  588.         period = 9,
  589.         state = 3,
  590.         eleconfig = "",
  591.     },
  592.     [66] = {
  593.         name = "dysprosium",
  594.         symbol = "Dy",
  595.         mass = 162.5,
  596.         group = 13,
  597.         period = 9,
  598.         state = 3,
  599.         eleconfig = "",
  600.     },
  601.     [67] = {
  602.         name = "holmium",
  603.         symbol = "Ho",
  604.         mass = 164.93033,
  605.         group = 14,
  606.         period = 9,
  607.         state = 3,
  608.         eleconfig = "",
  609.     },
  610.     [68] = {
  611.         name = "erbium",
  612.         symbol = "Er",
  613.         mass = 167.259,
  614.         group = 15,
  615.         period = 9,
  616.         state = 3,
  617.         eleconfig = "",
  618.     },
  619.     [69] = {
  620.         name = "thulium",
  621.         symbol = "Tm",
  622.         mass = 168.93422,
  623.         group = 16,
  624.         period = 9,
  625.         state = 3,
  626.         eleconfig = "",
  627.     },
  628.     [70] = {
  629.         name = "ytterbium",
  630.         symbol = "Yb",
  631.         mass = 173.045,
  632.         group = 17,
  633.         period = 9,
  634.         state = 3,
  635.         eleconfig = "",
  636.     },
  637.     [71] = {
  638.         name = "lutetium",
  639.         symbol = "Lu",
  640.         mass = 174.9668,
  641.         group = 18,
  642.         period = 9,
  643.         state = 3,
  644.         eleconfig = "",
  645.     },
  646.     [72] = {
  647.         name = "hafnium",
  648.         symbol = "Hf",
  649.         mass = 178.49,
  650.         group = 4,
  651.         period = 6,
  652.         state = 3,
  653.         eleconfig = "",
  654.     },
  655.     [73] = {
  656.         name = "tantalum",
  657.         symbol = "Ta",
  658.         mass = 180.94788,
  659.         group = 5,
  660.         period = 6,
  661.         state = 3,
  662.         eleconfig = "",
  663.     },
  664.     [74] = {
  665.         name = "tungsten",
  666.         symbol = "W",
  667.         mass = 183.84,
  668.         group = 6,
  669.         period = 6,
  670.         state = 3,
  671.         eleconfig = "",
  672.     },
  673.     [75] = {
  674.         name = "rhenium",
  675.         symbol = "Re",
  676.         mass = 186.207,
  677.         group = 7,
  678.         period = 6,
  679.         state = 3,
  680.         eleconfig = "",
  681.     },
  682.     [76] = {
  683.         name = "osmium",
  684.         symbol = "Os",
  685.         mass = 190.23,
  686.         group = 8,
  687.         period = 6,
  688.         state = 3,
  689.         eleconfig = "",
  690.     },
  691.     [77] = {
  692.         name = "iridium",
  693.         symbol = "Ir",
  694.         mass = 192.217,
  695.         group = 9,
  696.         period = 6,
  697.         state = 3,
  698.         eleconfig = "",
  699.     },
  700.     [78] = {
  701.         name = "platinum",
  702.         symbol = "Pt",
  703.         mass = 195.084,
  704.         group = 10,
  705.         period = 6,
  706.         state = 3,
  707.         eleconfig = "",
  708.     },
  709.     [79] = {
  710.         name = "gold",
  711.         symbol = "Au",
  712.         mass = 196.966569,
  713.         group = 11,
  714.         period = 6,
  715.         state = 3,
  716.         eleconfig = "",
  717.     },
  718.     [80] = {
  719.         name = "mercury",
  720.         symbol = "Hg",
  721.         mass = 200.59,
  722.         group = 12,
  723.         period = 6,
  724.         state = 2,
  725.         eleconfig = "",
  726.     },
  727.     [81] = {
  728.         name = "thallium",
  729.         symbol = "Tl",
  730.         mass = 204.38,
  731.         group = 13,
  732.         period = 6,
  733.         state = 3,
  734.         eleconfig = "",
  735.     },
  736.     [82] = {
  737.         name = "lead",
  738.         symbol = "Pb",
  739.         mass = 207.2,
  740.         group = 14,
  741.         period = 6,
  742.         state = 3,
  743.         eleconfig = "",
  744.     },
  745.     [83] = {
  746.         name = "bismuth",
  747.         symbol = "Bi",
  748.         mass = 208.9804,
  749.         group = 15,
  750.         period = 6,
  751.         state = 3,
  752.         eleconfig = "",
  753.     },
  754.     [84] = {
  755.         name = "polonium",
  756.         symbol = "Po",
  757.         mass = 209,
  758.         group = 16,
  759.         period = 6,
  760.         state = 3,
  761.         eleconfig = "",
  762.     },
  763.     [85] = {
  764.         name = "astatine",
  765.         symbol = "At",
  766.         mass = 210,
  767.         group = 17,
  768.         period = 6,
  769.         state = 3,
  770.         eleconfig = "",
  771.     },
  772.     [86] = {
  773.         name = "radon",
  774.         symbol = "Rn",
  775.         mass = 222,
  776.         group = 18,
  777.         period = 6,
  778.         state = 1,
  779.         eleconfig = "",
  780.     },
  781.     [87] = {
  782.         name = "francium",
  783.         symbol = "Fr",
  784.         mass = 223,
  785.         group = 1,
  786.         period = 7,
  787.         state = 3,
  788.         eleconfig = "",
  789.     },
  790.     [88] = {
  791.         name = "radium",
  792.         symbol = "Ra",
  793.         mass = 226,
  794.         group = 2,
  795.         period = 7,
  796.         state = 3,
  797.         eleconfig = "",
  798.     },
  799.     [89] = {
  800.         name = "actinium",
  801.         symbol = "Ac",
  802.         mass = 227,
  803.         group = 4,
  804.         period = 10,
  805.         state = 3,
  806.         eleconfig = "",
  807.     },
  808.     [90] = {
  809.         name = "thorium",
  810.         symbol = "Th",
  811.         mass = 232.0377,
  812.         group = 5,
  813.         period = 10,
  814.         state = 3,
  815.         eleconfig = "",
  816.     },
  817.     [91] = {
  818.         name = "protactinium",
  819.         symbol = "Pa",
  820.         mass = 231.03588,
  821.         group = 6,
  822.         period = 10,
  823.         state = 3,
  824.         eleconfig = "",
  825.     },
  826.     [92] = {
  827.         name = "uranium",
  828.         symbol = "U",
  829.         mass = 238.02891,
  830.         group = 7,
  831.         period = 10,
  832.         state = 3,
  833.         eleconfig = "",
  834.     },
  835.     [93] = {
  836.         name = "neptunium",
  837.         symbol = "Np",
  838.         mass = 237,
  839.         group = 8,
  840.         period = 10,
  841.         state = 3,
  842.         eleconfig = "",
  843.     },
  844.     [94] = {
  845.         name = "plutonium",
  846.         symbol = "Pu",
  847.         mass = 244,
  848.         group = 9,
  849.         period = 10,
  850.         state = 3,
  851.         eleconfig = "",
  852.     },
  853.     [95] = {
  854.         name = "americium",
  855.         symbol = "Am",
  856.         mass = 243,
  857.         group = 10,
  858.         period = 10,
  859.         state = 3,
  860.         eleconfig = "",
  861.     },
  862.     [96] = {
  863.         name = "curium",
  864.         symbol = "Cm",
  865.         mass = 247,
  866.         group = 11,
  867.         period = 10,
  868.         state = 3,
  869.         eleconfig = "",
  870.     },
  871.     [97] = {
  872.         name = "berkelium",
  873.         symbol = "Bk",
  874.         mass = 247,
  875.         group = 12,
  876.         period = 10,
  877.         state = 3,
  878.         eleconfig = "",
  879.     },
  880.     [98] = {
  881.         name = "californium",
  882.         symbol = "Cf",
  883.         mass = 251,
  884.         group = 13,
  885.         period = 10,
  886.         state = 3,
  887.         eleconfig = "",
  888.     },
  889.     [99] = {
  890.         name = "einsteinium",
  891.         symbol = "Es",
  892.         mass = 252,
  893.         group = 14,
  894.         period = 10,
  895.         state = 3,
  896.         eleconfig = "",
  897.     },
  898.     [100] = {
  899.         name = "fermium",
  900.         symbol = "Fm",
  901.         mass = 257,
  902.         group = 15,
  903.         period = 10,
  904.         state = 3,
  905.         eleconfig = "",
  906.     },
  907.     [101] = {
  908.         name = "mendelevium",
  909.         symbol = "Md",
  910.         mass = 258,
  911.         group = 16,
  912.         period = 10,
  913.         state = 3,
  914.         eleconfig = "",
  915.     },
  916.     [102] = {
  917.         name = "nobelium",
  918.         symbol = "No",
  919.         mass = 259,
  920.         group = 17,
  921.         period = 10,
  922.         state = 3,
  923.         eleconfig = "",
  924.     },
  925.     [103] = {
  926.         name = "lawrencium",
  927.         symbol = "Lr",
  928.         mass = 262,
  929.         group = 18,
  930.         period = 10,
  931.         state = 3,
  932.         eleconfig = "",
  933.     },
  934.     [104] = {
  935.         name = "rutherfordium",
  936.         symbol = "Rf",
  937.         mass = 267,
  938.         group = 4,
  939.         period = 7,
  940.         state = 0,
  941.         eleconfig = "",
  942.     },
  943.     [105] = {
  944.         name = "dubnium",
  945.         symbol = "Db",
  946.         mass = 268,
  947.         group = 5,
  948.         period = 7,
  949.         state = 0,
  950.         eleconfig = "",
  951.     },
  952.     [106] = {
  953.         name = "seaborgium",
  954.         symbol = "Sg",
  955.         mass = 271,
  956.         group = 6,
  957.         period = 7,
  958.         state = 0,
  959.         eleconfig = "",
  960.     },
  961.     [107] = {
  962.         name = "bohrium",
  963.         symbol = "Bh",
  964.         mass = 272,
  965.         group = 7,
  966.         period = 7,
  967.         state = 0,
  968.         eleconfig = "",
  969.     },
  970.     [108] = {
  971.         name = "hassium",
  972.         symbol = "Hs",
  973.         mass = 270,
  974.         group = 8,
  975.         period = 7,
  976.         state = 0,
  977.         eleconfig = "",
  978.     },
  979.     [109] = {
  980.         name = "meitnerium",
  981.         symbol = "Mt",
  982.         mass = 276,
  983.         group = 9,
  984.         period = 7,
  985.         state = 0,
  986.         eleconfig = "",
  987.     },
  988.     [110] = {
  989.         name = "darmstadtium",
  990.         symbol = "Ds",
  991.         mass = 281,
  992.         group = 10,
  993.         period = 7,
  994.         state = 0,
  995.         eleconfig = "",
  996.     },
  997.     [111] = {
  998.         name = "roentgenium",
  999.         symbol = "Rg",
  1000.         mass = 280,
  1001.         group = 11,
  1002.         period = 7,
  1003.         state = 0,
  1004.         eleconfig = "",
  1005.     },
  1006.     [112] = {
  1007.         name = "copernicium",
  1008.         symbol = "Cn",
  1009.         mass = 285,
  1010.         group = 12,
  1011.         period = 7,
  1012.         state = 0,
  1013.         eleconfig = "",
  1014.     },
  1015.     [113] = {
  1016.         name = "nihonium",
  1017.         symbol = "Nh",
  1018.         mass = 284,
  1019.         group = 13,
  1020.         period = 7,
  1021.         state = 0,
  1022.         eleconfig = "",
  1023.     },
  1024.     [114] = {
  1025.         name = "flerovium",
  1026.         symbol = "Fl",
  1027.         mass = 289,
  1028.         group = 14,
  1029.         period = 7,
  1030.         state = 0,
  1031.         eleconfig = "",
  1032.     },
  1033.     [115] = {
  1034.         name = "moscovium",
  1035.         symbol = "Mc",
  1036.         mass = 288,
  1037.         group = 15,
  1038.         period = 7,
  1039.         state = 0,
  1040.         eleconfig = "",
  1041.     },
  1042.     [116] = {
  1043.         name = "livermorium",
  1044.         symbol = "Lv",
  1045.         mass = 293,
  1046.         group = 16,
  1047.         period = 7,
  1048.         state = 0,
  1049.         eleconfig = "",
  1050.     },
  1051.     [117] = {
  1052.         name = "tennessine",
  1053.         symbol = "Ts",
  1054.         mass = 294,
  1055.         group = 17,
  1056.         period = 7,
  1057.         state = 0,
  1058.         eleconfig = "",
  1059.     },
  1060.     [118] = {
  1061.         name = "oganesson",
  1062.         symbol = "Og",
  1063.         mass = 294,
  1064.         group = 18,
  1065.         period = 7,
  1066.         state = 0,
  1067.         eleconfig = "",
  1068.     },
  1069. }
  1070. for a = 1, #elements do
  1071.     elements[a].number = a
  1072. end
  1073.  
  1074. local drawing = {} -- renders colors below elements
  1075. -- F-block
  1076. for y = 12, 21 do
  1077.     table.insert(drawing,{x=12,['y']=y,char="   ",col=colors.lightBlue})
  1078. end
  1079. for y = 17, 21 do
  1080.     table.insert(drawing,{x=12,['y']=y,char=(" "):rep(64),col=colors.lightBlue})
  1081. end
  1082. -- state labels
  1083. table.insert(drawing,{x=13,y=2,char="Solid  ",col=colors.brown,txt=colors.white})
  1084. table.insert(drawing,{x=13,y=3,char="Liquid ",col=colors.blue,txt=colors.white})
  1085. table.insert(drawing,{x=13,y=4,char="Gas    ",col=colors.yellow,txt=colors.black})
  1086. table.insert(drawing,{x=13,y=5,char="Unknown",col=colors.black,txt=colors.white})
  1087. table.insert(drawing,{x=21,y=3,char="<-- State at 64 F",col=colors.lightGray})
  1088. -- instructions
  1089. table.insert(drawing,{x=21,y=5,char="Arrow keys to scroll",col=colors.lightGray})
  1090. table.insert(drawing,{x=21,y=6,char="Press [Q] to quit",col=colors.lightGray})
  1091.  
  1092.  
  1093. local renderElements = function(ele,xscroll,yscroll)
  1094.     term.current().setVisible(false)
  1095.     term.setBackgroundColor(colors.lightGray)
  1096.     term.clear()
  1097.     term.setTextColor(colors.white)
  1098.     for a = 1, #drawing do
  1099.         term.setCursorPos((drawing[a].x)-xscroll,(drawing[a].y)-yscroll)
  1100.         term.setBackgroundColor(drawing[a].col)
  1101.         if drawing[a].txt then
  1102.             term.setTextColor(drawing[a].txt)
  1103.         else
  1104.             term.setTextColor(colors.black)
  1105.         end
  1106.         term.write(drawing[a].char)
  1107.     end
  1108.     for a = 1, #ele do
  1109.         if ele[a].state == 1 then
  1110.             term.setBackgroundColor(colors.yellow)
  1111.             term.setTextColor(colors.black)
  1112.         elseif ele[a].state == 2 then
  1113.             term.setBackgroundColor(colors.blue)
  1114.             term.setTextColor(colors.white)
  1115.         elseif ele[a].state == 3 then
  1116.             term.setBackgroundColor(colors.brown)
  1117.             term.setTextColor(colors.white)
  1118.         else
  1119.             term.setBackgroundColor(colors.black)
  1120.             term.setTextColor(colors.white)
  1121.         end
  1122.         term.setCursorPos((ele[a].group*4)-xscroll,(ele[a].period*2)-yscroll)
  1123.         term.write((ele[a].symbol.."  "):sub(1,3))
  1124.     end
  1125.     term.current().setVisible(true)
  1126. end
  1127.  
  1128. local cleanExit = function()
  1129.     term.setBackgroundColor(colors.black)
  1130.     term.setTextColor(colors.white)
  1131.     term.clear()
  1132.     term.setCursorPos(1,1)
  1133.     print("Bye!")
  1134.     sleep(0)
  1135.     return
  1136. end
  1137.  
  1138. local xscr = 0
  1139. local yscr = 0
  1140. local keysDown = {}
  1141. local viewingElement = false
  1142.  
  1143. local cprint = function(txt,_y)
  1144.     local x,y = term.getSize()
  1145.     local cx,cy = term.getCursorPos()
  1146.     term.setCursorPos((x/2)-math.ceil(#txt/2),_y or cy)
  1147.     return print(txt)
  1148. end
  1149.  
  1150. local viewElement = function(ele)
  1151.     term.setBackgroundColor(colors.white)
  1152.     term.clear()
  1153.     term.setBackgroundColor(colors.lightBlue)
  1154.     term.setTextColor(colors.black)
  1155.     term.setCursorPos(1,2)
  1156.     term.clearLine()
  1157.     cprint(ele.name:upper())
  1158.     term.setBackgroundColor(colors.white)
  1159.     print("Symbol: "..ele.symbol)
  1160.     print("Atomic #: "..ele.number)
  1161.     print("Atomic mass: "..ele.mass)
  1162.     print("Neutron #: "..math.floor(ele.mass)-ele.number)
  1163.     write("\nState of matter: ")
  1164.     if ele.state == 1 then
  1165.         print("Gas")
  1166.     elseif ele.state == 2 then
  1167.         print("Liquid")
  1168.     elseif ele.state == 3 then
  1169.         print("Solid")
  1170.     else
  1171.         print("Unknown")
  1172.     end
  1173.     print("\nPeriod "..((ele.period <= 7 and ele.period) or (ele.period-3)))
  1174.     print("Group "..((ele.period <= 7 and ele.group) or "F-block").."\n")
  1175.     if elements[ele.number-1] then
  1176.         print("Prev: "..elements[ele.number-1].name)
  1177.     end
  1178.     if elements[ele.number+1] then
  1179.         print("Next: "..elements[ele.number+1].name)
  1180.     end
  1181.     sleep(0)
  1182.     local evt,butt
  1183.     while true do
  1184.         evt,butt = os.pullEvent()
  1185.         if evt == "key" then
  1186.             if butt == keys.left or butt == keys.right then
  1187.                 return butt
  1188.             else
  1189.                 return
  1190.             end
  1191.         elseif evt == "mouse_click" then
  1192.             if butt == 1 then
  1193.                 return
  1194.             end
  1195.         end
  1196.     end
  1197. end
  1198.  
  1199. local getKeys = function()
  1200.     while true do
  1201.         local evt,key = os.pullEvent()
  1202.         if evt == "key" then
  1203.             keysDown[key] = true
  1204.         elseif evt == "key_up" then
  1205.             keysDown[key] = false
  1206.         end
  1207.     end
  1208. end
  1209.  
  1210. local getKeyScrolling = function()
  1211.     while true do
  1212.         sleep(0.05)
  1213.         if not viewingElement then
  1214.             if keysDown[keys.left] then
  1215.                 if xscr > 0 then
  1216.                     xscr = xscr - 1
  1217.                 end
  1218.             elseif keysDown[keys.right] then
  1219.                 if xscr < 76-scr_x then
  1220.                     xscr = xscr + 1
  1221.                 end
  1222.             end
  1223.             if keysDown[keys.down] then
  1224.                 if yscr < 4 then
  1225.                     yscr = yscr + 1
  1226.                 end
  1227.             elseif keysDown[keys.up] then
  1228.                 if yscr > 0 then
  1229.                     yscr = yscr - 1
  1230.                 end
  1231.             end
  1232.             if keysDown[keys.q] then
  1233.                 return cleanExit()
  1234.             end
  1235.             renderElements(elements,xscr,yscr)
  1236.         end
  1237.     end
  1238. end
  1239.  
  1240. local getMouseInput = function()
  1241.     while true do
  1242.         local evt,butt,x,y = os.pullEvent("mouse_click")
  1243.         local _x,_y = x+xscr,y+yscr
  1244.         for a = 1, #elements do
  1245.             local e = elements[a]
  1246.             if (_x >= (e.group*4) and _x <= (e.group*4)+2) and (_y == e.period*2) then
  1247.                 viewingElement = true
  1248.                 local b = a
  1249.                 while true do
  1250.                     e = elements[b]
  1251.                     local eeh = viewElement(e)
  1252.                     if eeh == keys.left and elements[b-1] then
  1253.                         b = b - 1
  1254.                     elseif eeh == keys.right and elements[b+1] then
  1255.                         b = b + 1
  1256.                     else
  1257.                         break
  1258.                     end
  1259.                 end
  1260.                 viewingElement = false
  1261.                 break
  1262.             end
  1263.         end
  1264.     end
  1265. end
  1266.  
  1267. local doFunks = {
  1268.     getMouseInput,
  1269.     getKeyScrolling,
  1270.     getKeys,
  1271. }
  1272.  
  1273. parallel.waitForAny(unpack(doFunks))
Add Comment
Please, Sign In to add comment