// подправил для наглядности
using System;
using System.Linq;
namespace SiO2
{
class Program
{
static void Main(string[] args)
{
var name = "SiO2 (полиморф.)";
var curTemp = 846.15;
var (h, s, a, b, c) = (-1f, -1f, -1f, -1f, -1f);
var names = new string[]
{
"SiO2 (β-кварц)",
"SiO2 (α-кварц)",
"SiO2 (α-тридимит)",
"SiO2 (β-кристобалит)",
"SiO2(к) кварц",
"SiO2(к) тридимит",
"SiO2(к) кристобалит",
"SiO2 (полиморф.)"
};
var values = new (float, float, float, float, float)[]
{
(-217.75F, 10.00F, 11.22F, 8.2F, -2.70F),
(-217.60F, 0.00F, 14.41F, 1.94F, 0.00F),
(-216.50F, 10.40F, 13.64F, 2.64F, 0.00F),
(-215.95F, 10.19F, 4.28F, 21.06F, 0.00F)
};
if (names.Contains(name))
{
if (curTemp <= 846.15)
(h, s, a, b, c) = values[0];
else if (curTemp >= 846.15)
(h, s, a, b, c) = values[1];
else if (curTemp >= 1143.15)
(h, s, a, b, c) = values[2];
else if (curTemp >= 1743.15)
(h, s, a, b, c) = values[3];
}
Console.WriteLine(h);
Console.WriteLine(s);
Console.WriteLine(a);
Console.WriteLine(b);
Console.WriteLine(c);
}
}
}
StringBuilder sb = new StringBuilder();
sb.Append("первая");
sb.Append("вторая");
if(value != 1) sb.Append("строка не равная 1");
sb.Append("третья");
private static string[] _elementNames = new[] { "SiO2 (β-кварц)", "and", "more"};
....
if (_elementNames.Contains(name))
{
if (curTemp <= 846.15)
{
h = -217.75F;
s = 10F;
a = 11.22F;
b = 8.2F;
c = -2.7F;
}
else if (....) { ....}
....
}
br.BaseStream.Position = 0x6F0;
- Тут можно и в десятичной системе писатьbr.ReadInt32()
(32 бита)bw.Seek(0x6F0, SeekOrigin.Begin);
bw.Write(skill + 10);
(используется перегрузка, которая принимает int - тоесть 32 бит)using (var file = File.Open("Player.chr", FileMode.Open, FileAccess.ReadWrite))
{
int skillPoints;
using (var br = new BinaryReader(file))
{
br.BaseStream.Position = 4863; //0x12FF
skillPoints = br.ReadInt32();
}
using (var bw = new BinaryWriter(file))
{
bw.BaseStream.Position = 4863; //0x12FF
bw.Write(skillPoints + 10);
}
}
{ "n1": 1, "n2": 5, "n3": 11, "n4": 12 } => "[1,5,11,12]"
{ "n1": 1, "n2": 5, "n3": 12, "n4": 11 } => "[1,5,11,12]"
const makeHash = (obj) => JSON.stringify(Object.values(obj).sort((a, b) => a - b));
const hashes = list.map(makeHash);
const result = list.filter((el, i) => i === hashes.indexOf(makeHash(el)))
[
{
"n1": 18,
"n2": 1,
"n3": 5,
"n4": 17
},
{
"n1": 1,
"n2": 2,
"n3": 11,
"n4": 6
},
{
"n1": 1,
"n2": 5,
"n3": 11,
"n4": 12
},
{
"n1": 6,
"n2": 17,
"n3": 12,
"n4": 1
},
{
"n1": 4,
"n2": 7,
"n3": 8,
"n4": 20
},
{
"n1": 2,
"n2": 3,
"n3": 8,
"n4": 7
},
{
"n1": 2,
"n2": 8,
"n3": 7,
"n4": 6
},
{
"n1": 14,
"n2": 15,
"n3": 11,
"n4": 10
},
{
"n1": 11,
"n2": 8,
"n3": 16,
"n4": 15
},
{
"n1": 11,
"n2": 12,
"n3": 6,
"n4": 14
},
{
"n1": 17,
"n2": 12,
"n3": 5,
"n4": 1
},
{
"n1": 8,
"n2": 9,
"n3": 13,
"n4": 19
},
{
"n1": 8,
"n2": 9,
"n3": 19,
"n4": 15
},
{
"n1": 10,
"n2": 9,
"n3": 15,
"n4": 8
},
{
"n1": 11,
"n2": 12,
"n3": 17,
"n4": 6
}
]
<span class="counter">100</span>
let counter = $('span.counter');
setInterval(function () {
let min = (Math.random() > 0.5) ? 0 : 5;
let max = (Math.random() > 0.5) ? 5 : 10;
let c = parseInt(counter.text());
let r = Math.floor(Math.random() * (max - min + 1)) + min;
if (Math.random() > 0.5) {
counter.text(c + r);
}
}, 2000);
const fourValues = four.map(Object.values);
const result = three.map(n => {
const values = Object.values(n);
const intersections = fourValues.filter(m => values.every(v => m.includes(v)));
return `${values} - ${intersections.length
? `входит в / ${intersections.map(m => `${m}`).join(' / ')} /`
: 'нет вхождений'}`;
});
^([^|\n]+)\|([-.\d]+)\|([-.\d]+)\|([-.\d]+)\|([-.\d]+)\|([-.\d]+)
{"name":'$1', "h":$2, "s":$3, "a":$4, "b":$5, "c":$6},