Инфраструктура открытых ключей в Windows Server 2016. Часть 3. Issuing CA Степан Москалев, Леонид Шапиро [Version] Signature="$Windows NT$" [PolicyStatementExtension] Policies=InternalPolicy [InternalPolicy] OID=1.2.3.4.1455.67.89.5 URL=http://pki.nwtraders.msft/PKI/cps.txt [certsrv_server] RenewalKeyLength=2048 RenewalValidityPeriodUnits=5 RenewalValidityPeriod=Years CRLPeriodUnits=1 CRLPeriod=Weeks CRLOverlapUnits=1 CRLOverlapPeriod=Days CRLDeltaPeriodUnits=1 CRLDeltaPeriod=Days LoadDefaultTemplates=0 AlternateSignatureAlgorithm=1 Install-AdcsCertificationAuthority –CAType EnterpriseSubordinateCA –CACommonName "IssuingCA01" –KeyLength 2048 –HashAlgorithmName SHA256 –CryptoProviderName "RSA#Microsoft Software Key Storage Provider" Certreq -submit C:\test\ICA01.Nwtraders.msft_IssuingCA01.req certutil -resubmit 2 certreq –Retrieve 2 C:\test\ICA01.crt certutil -installCert C:\test\ICA01.crt certutil –addstore –f root C:\test\RootCA_ROOTCA.crt Start-Service CertSvc certutil –dspublish –f C:\test\ROOTCA_ROOTCA.crt // публикация сертификата certutil –dspublish –f C:\test\ROOTCA.crl ROOTCA //публикация списка отзыва сертификатов $crllist = Get-CACrlDistributionPoint foreach ($crl in $crllist) { Remove-CACrlDistributionPoint $crl.uri -Force } Add-CACRLDistributionPoint -Uri C:\Windows\System32\CertSrv\CertEnroll\%3%8%9.crl -PublishToServer -PublishDeltaToServer -Force Add-CACRLDistributionPoint -Uri http://pki.nwtraders.msft/PKI/%3%8%9.crl -AddToCertificateCDP -AddToFreshestCrl -Force Add-CACRLDistributionPoint -Uri "ldap:///CN=%7%8,CN=%2,CN=CDP,CN=Public Key Services,CN=Services,%6%10" -PublishToServer -AddToCrlCdp -AddToFreshestCrl -AddToCertificateCDP -PublishDeltaToServer -Force Add-CACRLDistributionPoint -Uri \\pki.nwtraders.msft\pki\%3%8%9.crl -PublishToServer -PublishDeltaToServer -Force $aialist = Get-CAAuthorityInformationAccess foreach ($aia in $aialist) { Remove-CAAuthorityInformationAccess $aia.uri -Force } certutil -setreg CA\CACertPublicationURLs "1:C:\Windows\system32\CertSrv\CertEnroll\%3%4.crt\ n1:\\pki.nwtraders.msft\pki\%3%4.crt" Add-CAAuthorityInformationAccess http://pki.nwtraders.msft/PKI/%3%4.crt -AddToCertificateAia -Force Add-CAAuthorityInformationAccess "ldap:///CN=%7,CN=AIA,CN=Public Key Services,CN=Services,%6%11" -AddToCertificateAia -Force certutil -setreg CA\ValidityPeriodUnits 5 certutil -setreg CA\ValidityPeriod "Years" certutil -setreg CA\CRLPeriodUnits 1 certutil -setreg CA\CRLPeriod "Weeks" certutil -setreg CA\CRLOverlapUnits 1 certutil -setreg CA\CRLOverlapPeriod "Days" certutil -setreg CA\CRLDeltaPeriodUnits 1 certutil -setreg CA\CRLDeltaPeriod "Days" certutil -setreg CA\AuditFilter 127 Restart-Service CertSvc certutil -CRL ----------------------------------------------------------------------------------------- «Муравей Лэнгтона» в 1С Кирилл Ткаченко Перем ЦВЕТ_БЕЛЫЙ, ЦВЕТ_ЧЕРНЫЙ; Перем ШИРИНА, ВЫСОТА; Перем x, y; Перем НАИБ_ШАГ; Перем Направление; Перем Шаг; Перем Поле; Перем Рез; Перем i, j; ЦВЕТ_БЕЛЫЙ = "."; ЦВЕТ_ЧЕРНЫЙ = "o"; ШИРИНА = 64; ВЫСОТА = 64; x = Цел(ШИРИНА / 2); y = Цел(ВЫСОТА / 2); НАИБ_ШАГ = 20000; Направление = 0; Шаг = 0; Поле = Новый Массив(ВЫСОТА, ШИРИНА); Для i = 0 По ВЫСОТА - 1 Цикл Для j = 0 По ШИРИНА - 1 Цикл Поле[i][j] = ЦВЕТ_БЕЛЫЙ; КонецЦикла; КонецЦикла; Пока (Шаг < НАИБ_ШАГ) И (0 <= y) И (y < ВЫСОТА) И (0 <= x) И (x < ШИРИНА) Цикл Если Поле[y][x] = ЦВЕТ_БЕЛЫЙ Тогда Поле[y][x] = ЦВЕТ_ЧЕРНЫЙ; Направление = Направление + 1; Иначе Поле[y][x] = ЦВЕТ_БЕЛЫЙ; Направление = Направление + 3; КонецЕсли; Направление = Направление % 4; Если Направление = 0 Тогда y = y - 1; ИначеЕсли Направление = 1 Тогда x = x + 1; ИначеЕсли Направление = 2 Тогда y = y + 1; Иначе x = x - 1; КонецЕсли; Шаг = Шаг + 1; КонецЦикла; Рез = ""; Для i = 0 По ВЫСОТА - 1 Цикл Для j = 0 По ШИРИНА - 1 Цикл Рез = Рез + Поле[i][j]; КонецЦикла; Рез = Рез + "" ""; КонецЦикла; Сообщить(Рез); ----------------------------------------------------------------------------------------- Система интеллектуального совместного перевода англоязычных текстов Павел Поваляев, Данила Шариков public class Text { [Key] public int id { get; set; } public string TextName { get; set; } public string FullText { get; set; } [NotMapped] public bool EngState { get; set; } [NotMapped] public List parts { get; set; } } public class PartText { public int idPart { get; set; } public int idText { get; set; } public string EngPart { get; set; } public string RusPart { get; set; } [NotMapped] public bool StateTransl { get; set; } } public class Word { [Key] public int idWord { get; set; } public string RusWord { get; set; } public string EngWord { get; set; } } public class User { public int id { get; set; } public string Username { get; set; } public string Biography { get; set; } } using Microsoft.EntityFrameworkCore; using MySQL.Data.EntityFrameworkCore.Extensions; public void ConfigureServices(IServiceCollection services) { services.AddDbContext(options => { options.UseMySQL("server=localhost;user=root;database=webserverdb;port=3306;password=********;"); }); services.AddMvc(); } public class ServerDbContext : DbContext { public ServerDbContext(DbContextOptions options) : base(options) { } public DbSet Users { get; set; } public DbSet Texts { get; set; } public DbSet PartTexts { get; set; } public DbSet Words{ get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(c => new { c.idPart, c.idText}); modelBuilder.Entity().Property(c => c.EngPart).HasColumnType("TEXT"); modelBuilder.Entity().Property(c => c.RusPart).HasColumnType("TEXT"); } } DbSet<Имя_модели> Имя_таблицы{get;set;} public class HomeController : Controller { ServerDbContext db; List texts; List parts; public HomeController(ServerDbContext context) { db = context; texts = db.Texts.ToList(); parts = db.PartTexts.ToList(); foreach (PartText t in parts) { texts[t.idText – 1].parts.Add(t); } if (!db.PartTexts.Any()) { foreach (Text t in texts) { t.DoParts(); foreach (PartText pt in t.parts) { db.PartTexts.Add(pt); db.SaveChanges(); } } } } [HttpPost] public IActionResult PartText(int indexText, int indexPart, string EngPart) { texts[indexText-1].parts[indexPart-1].EngPart = EngPart; db.PartTexts.Update(texts[indexText-1].parts[indexPart-1]); db.SaveChanges(); return View(abc[indexText-1]); } [HttpPost] public IActionResult PartText(int indexText) { return View(texts[indexText-1]); } public IActionResult Index() { return View(abc); } [HttpPost] public IActionResult TranslatePart(int indexText, int indexPart) { return View(texts[indexText-1].parts[indexPart-1]); } } public void DoParts() { char[] znak = { '.', '!', '?' }; var sentences = new List(); int position = 0; int start = 0; do { position = FullText.IndexOfAny(znak, start); if (position >= 0) { sentences.Add(FullText.Substring(start, position – start + 1).Trim()); start = position + 1; } } while (position > 0); int index = 1; foreach(string s in sentences) { PartText part = new PartText(); part.idText = id; part.idPart = index; if (EngState) { part.EngPart = s; } else part.RusPart = s; parts.Add(part); index++; } } название_метода?параметр1=значение1&параметр2=значение2 @model IEnumerable @{ ViewData["Title"] = "Home Page"; }

Доступные тексты

@foreach (var texts in Model) { }
Название текста Содержимое
@texts.TextName @texts.FullText
----------------------------------------------------------------------------------------- Программные реализации для оператора проецирования Кирилл Ткаченко Для i = 1,N: Для j = 1,N: R[i][j] ← (b – 1,0) * a[i] * a[j] Если i = j То R[i][j] ← R[i][j] + 1,0 s ← 0 Для i = 1,N: p1[i] ← 0 Для j = 1,N: w ← (b – 1) * a[i] * a[j] Если i = j, то w ← w + 1 p1[i] ← p1[i] + w * p[j] s ← s + |p1[i]| Для i = 1,N : p1[i] ← p1[i] / s Листинг 1. Исходный текст демонстрационной программы на школьном алгоритмическом языке КуМир цел n = 5 алг Прим нач вещ таб a[1:n], p[1:n], p2[1:n] вещ b init_mas(a) a[3] := a[3] + 0.5 b := 2.0 init_mas(p) Rоп(a, b, p, p2) вывод "a = " write_mas(a) вывод нс вывод "b = ", b, нс вывод "p = " write_mas(p) вывод нс вывод "p2 = " write_mas(p2) вывод нс вывод "SumP2 = ", uslov_normir(p2), нс кон алг Rоп(вещ таб a[1:n], вещ b, вещ таб p[1:n], рез вещ таб p1[1:n]) нач вещ s, w цел i, j s := 0.0 нц для i от 1 до n p1[i] := 0.0 нц для j от 1 до n w := (b - 1.0) * a[i] * a[j] если i = j то w := w + 1.0 все p1[i] := p1[i] + w * p[j] кц s := s + abs(p1[i]) кц нц для i от 1 до n p1[i] := p1[i] / s кц кон алг write_mas(вещ таб a[1:n]) нач цел i вывод "[" нц для i от 1 до n вывод a[i]:6:4, ", " кц вывод "]" кон алг init_mas(рез вещ таб a[1:n]) нач цел i нц для i от 1 до n a[i] := 1.0 / n кц кон алг вещ uslov_normir(вещ таб a[1:n]) нач вещ s цел i s := 0 нц для i от 1 до n s := s + a[i] кц знач := s кон Листинг 2. Исходный текст демонстрационной программы на языке программирования высокого уровня Паскаль program ex; const n = 5; type mas = array [1..n] of real; procedure write_mas(a: mas); var i: integer; begin write('['); for i := 1 to n do write(a[i]:6:4, ', '); write(']'); end; procedure init_mas(var a: mas); var i: integer; begin for i := 1 to n do a[i] := 1.0 / n; end; function uslov_normir(a: mas): real; var s: real; i: integer; begin s := 0; for i := 1 to n do s := s + a[i]; uslov_normir := s; end; function Rop(a: mas; b: real; p: mas): mas; var p1: mas; s, w: real; i, j: integer; begin s := 0.0; for i := 1 to n do begin p1[i] := 0.0; for j := 1 to n do begin w := (b - 1.0) * a[i] * a[j]; if i = j then w := w + 1.0; p1[i] := p1[i] + w * p[j]; end; s := s + abs(p1[i]); end; for i := 1 to n do p1[i] := p1[i] / s; Rop := p1; end; procedure main; var a, p, p2: mas; b: real; begin init_mas(a); a[3] := a[3] + 0.5; b := 2.0; init_mas(p); p2 := Rop(a, b, p); write('a = '); write_mas(a); writeln; writeln('b = ', b); write('p = '); write_mas(p); writeln; write('p2 = '); write_mas(p2); writeln; writeln('SumP2 = ', uslov_normir(p2)); end; begin main; end. Листинг 3. Исходный текст демонстрационной программы на языке программирования высокого уровня Си #include #include #define n 5 void write_mas(double a[n]) { int i; printf("["); for (i = 0; i < n; ++i) printf("%6.4f, ", a[i]); printf("]"); } void init_mas(double a[n]) { int i; for (i = 0; i < n; ++i) a[i] = 1.0 / n; } double uslov_normir(double a[n]) { double s = 0.0; int i; for (i = 0; i < n; ++i) s += a[i]; return s; } void Rop(double a[n], double b, double p[n], double p1[n]) { double s = 0.0; double w; int i, j; for (i = 0; i < n; ++i) { p1[i] = 0.0; for (j = 0; j < n; ++j) { w = (b - 1.0) * a[i] * a[j]; if (i == j) ++w; p1[i] += w * p[j]; } s += fabs(p1[i]); } for (i = 0; i < n; ++i) p1[i] /= s; } int main(int argc, char * argv[]) { double a[n], p[n], p2[n]; double b; init_mas(a); a[2] += 0.5; b = 2.0; init_mas(p); Rop(a, b, p, p2); printf("a = "); write_mas(a); printf("\n"); printf("b = %6.4f\n", b); printf("p = "); write_mas(p); printf("\n"); printf("p2 = "); write_mas(p2); printf("\n"); printf("SumP2 = %6.4f\n", uslov_normir(p2)); (void)argc, (void)argv; /* Чтобы избежать WARNING. */ return 0; } Листинг 4. Исходный текст демонстрационной программы на языке программирования высокого уровня Python # -*- coding: utf-8 -*- n = 5 def init_mas(): return [1.0 / n for i in range(n)] def Rop(a, b, p): s = 0.0 p1 = list(range(n)) for i in range(n): p1[i] = 0.0 for j in range(n): w = (b - 1.0) * a[i] * a[j] if i == j: w += 1.0 p1[i] += w * p[j] s += abs(p1[i]) for i in range(n): p1[i] /= s return p1 a = init_mas() a[2] += 0.5 b = 2.0 p = init_mas() p2 = Rop(a, b, p) print("a = %s" % a) print("b = %s" % b) print("p = %s" % p) print("p2 = %s" % p2) print("SumP2 = %s" % sum(p2)) ----------------------------------------------------------------------------------------- Анализ финитных солитонов в уравнении Бенджамина – Уизема Егорова М.В. void fright(double *x, double *y) { y[0]= x[2]; y[1]= x[0]*x[0]*x[0]/2-x[0]*x[0]; y[2]= x[0]*x[3]/D; y[3]=-x[0]*(x[2]+x[1])/D; y[4]=1.0; y[5]=fabs(x[0]); return ; } void runge(int n, double h, double *x, double *y, double *w, void(*fright)(double*,double*)) { int i, k2, k3, k4, z; k2=n; k3=2*n; k4=3*n; z=4*n; fright( x, w ); for( i=0; i < n; i++ ) { w[z + i] = x[i] + w[i]*h/2; } fright( &w[z], &w[k2] ); for( i=0; i < n; i++ ) { w[z + i] = x[i] + w[k2 + i]*h/2; } fright( &w[z], &w[k3] ); for( i=0; i < n; i++ ) { w[z + i] = x[i] + w[k3 + i]*h; } fright( &w[z], &w[k4] ); for( i=0; i < n; i++ ) { y[i] = x[i] + h*(w[i] + 2*(w[n + i] + w[k3 + i]) + w[k4 + i])/6.0; } return; } double funout(double *xb) { return xb[2]; } int mapping(int nEq, double hRunge, double *x0, double *xk, double *w, void(*fRight)(double*,double*), double(*funOut)(double*)) { const int maxStep = 100000; int iStep; double f0, f1, f2, h0, h1, h2; q=0; f2 = funOut(x0); for(iStep = 0;;iStep++) { if(iStep > maxStep) { return 1; } runge(nEq, hRunge, x0, xk, w, fRight); f1 = f2; f2 = funOut(xk); if(iStep > 2 && f1*f2 <= 0) { break; } memcpy(x0, xk, nEq*sizeof(double)); for(int i=0;i 1e-12) { h0 = 0.5*(h1 + h2); runge(nEq, h0, x0, xk, w, fRight); f0 = funOut(xk); if(f1*f0 <= 0) { f2 = f0; h2 = h0; } else { f1 = f0; h1 = h0; } } h0 = 0.5*(h1 + h2); runge(nEq, h0, x0, xk, w, fRight); return 0; } void reshenie(double *x, double *y, double *w, double h,int resh) { asimpt(x); for(int j=0;jShow(); if(resh==1) { for(int i=0;iSeries4->AddXY(way[4][i],way[0][i]); Form1->Series4->AddXY(-way[4][i],way[0][i]); Form2->Series1->AddXY(way[4][i],pow(way[0][i],2.000)/2.000); Form2->Series1->AddXY(-way[4][i],pow(way[0][i],2.000)/2.000); } } else if(resh==2) { for(int i=0;iSeries4->AddXY(way[4][i],way[0][i]); Form1->Series4->AddXY(-way[4][i],way[0][i]); Form2->Series2->AddXY(way[4][i],pow(way[0][i],2.000)/2.000); Form2->Series2->AddXY(-way[4][i],pow(way[0][i],2.000)/2.000); } } else if(resh==3) { for(int i=0;iSeries5->AddXY(way[4][i],way[0][i]); Form1->Series5->AddXY(-way[4][i],way[0][i]); Form2->Series3->AddXY(way[4][i],pow(way[0][i],2.000)/2.000); Form2->Series3->AddXY(-way[4][i],pow(way[0][i],2.000)/2.000); } } else if(resh==4) { for(int i=0;iSeries6->AddXY(way[4][i],way[0][i]); Form1->Series6->AddXY(-way[4][i],way[0][i]); Form2->Series4->AddXY(way[4][i],pow(way[0][i],2.000)/2.000); Form2->Series4->AddXY(-way[4][i],pow(way[0][i],2.000)/2.000); } } } double determinant3(int lengthRow, double *a) { void metod_gauss(double a[4][4], double b[4], double x[4] ) { double d, s; for (int k = 0; k < 4; k++) { for (int j = k + 1; j < 4; j++) { d = a[j][k] / a[k][k]; for (int i = k; i < 4; i++) { a[j][i] = a[j][i] - d * a[k][i]; } b[j] = b[j] - d * b[k]; } } for (int k = 4-1; k >= 0; k--) { d = 0; for (int j = k + 1; j < 4; j++) { s = a[k][j] * x[j]; d = d + s; } x[k] = (b[k] - d) / a[k][k]; } cout<Series7->AddXY(way[0][j],way[1][j]); Form2->Series7->AddXY(way[0][j],-way[1][j]); } double T=2*y[4]; x[0]=r0; x[1]=0.000; x[2]=0.000; x[3]=-sqrt(x[0]*x[0]*x[0]*x[0]/4.000-2.000*x[0]*x[0]*x[0]/3.000); x[4]=0.0000; x[5]=0.0000; for(int j=0;jSeries8->AddXY(way[0][j],way[1][j]); Form2->Series8->AddXY(way[0][j],-way[1][j]); } } else if(resh==3) { for(int ww=0;ww<8;ww++) { mapping(n,h,x,y,w,fright,funout); for(int j=0;jSeries8->AddXY(way[0][j],way[1][j]); } } } } void __fastcall TForm1::FormActivate(TObject *Sender) { int t=0,u=0; double *x,*y,*w, h=0.001 , H1,H2; double *d2, b=1.000, da,dl,dr,dk,ya,yb,va,vb=0,ra,rl,rr,rk,r0k[2],rel; D=sqrt(0.3); x=new double[n]; y=new double[n]; w=new double[5*n]; d2=new double[30]; asimpt(x); for(int j=0;jAddXY(y[0],y[1]); } } x[0]= -10.5; x[1]= 0.000; x[2]= 0.000; x[3]= -sqrt(x[0]*x[0]*x[0]*x[0]/4.000-2.000*x[0]*x[0]*x[0]/3.000); x[4]=0.000; x[5]=0.000; for(int j=0;jAddXY(y[0],y[1]); } ----------------------------------------------------------------------------------------- Разработка методов демпфирования колебаний с помощью точечных стационарных демпферов. Часть 2. Колебания плоской мембраны Троенко С.Ю., Поваляев П.П. Листинг 1. Прямой расчет в функции GetU() for (int n = 0; n <= N; n++) for (int k = 0; k <= M1; k++) for (int m = 0; m <= M2; m++) { if (k == 10 && m == 10) G[k, m, n] = W1[n] + h; else G[k, m, n] = 0; } for (int n = 0; n <= N; n++) for (int m = 0; m <= M2; m++) { U[0, m, n] = 0; U[M1, m, n] = Math.Sin(l1) * Math.Sinh(m * hy); } for (int n = 0; n <= N; n++) for (int k = 0; k <= M1; k++) { U[k, 0, n] = 0; U[k, M2, n] = Math.Sin(k * hx) * Math.Sinh(l2); } for (int k = 1; k <= M1 - 1; k++) for (int m = 1; m <= M2 - 1; m++) U[k, m, 0] = GetH0(k * hx, m * hy); for (int k = 1; k <= M1 - 1; k++) for (int m = 1; m <= M2 - 1; m++) U[k, m, 1] = a * a * tau * tau / (2.0 * hx * hx) * (U[k - 1, m, 0] - 2 * U[k, m, 0] + U[k + 1, m, 0]) + a * a * tau * tau / (2.0 * hy * hy) * (U[k, m - 1, 0] - 2 * U[k, m, 0] + U[k, m + 1, 0]) + U[k, m, 0] + tau * GetH1(k * hx, m * hy); for (int n = 1; n <= N - 1; n++) for (int k = 1; k <= M1 - 1; k++) for (int m = 1; m <= M2 - 1; m++) U[k, m, n + 1] = a * a * tau * tau / (hx * hx) * (U[k - 1, m, n] - 2 * U[k, m, n] + U[k + 1, m, n]) + a * a * tau * tau / (hy * hy) * (U[k, m - 1, n] - 2 * U[k, m, n] + U[k, m + 1, n]) + tau * tau * G[k, m, n] + 2 * U[k, m, n] - U[k, m, n - 1]; for (int k = 1; k <= M1 - 1; k++) for (int m = 1; m <= M2 - 1; m++) E += ((U[k, m, N] - U[k, m, N - 1]) / tau) * ((U[k, m, N] - U[k, m, N - 1]) / tau) + U[k, m, N] * U[k, m, N]; E *= hx * hy; Console.WriteLine("E = " + E); return E; } Листинг 2. Код функции Minimize() if (Math.Abs(W1_old - w1[n]) < 0.0001) { Console.WriteLine("W1_old = " + W1_old + " , w1[n] = " + w1[n]); while (h > 0.0001) { Minimize(w1, n); }; result[n] = w1[n]; h = 0.1; return; } } W1_old = w1[n]; E2 = func(ref U, 0, w1); E1 = func(ref U, -h, w1); E3 = func(ref U, h, w1); a = (E1 - 2 * E2 + E3) / (2.0 * h * h); if (a > 0) { b = (E3 - E1) / (2.0 * h); w1[n] = W1_old - b / (2.0 * a); Minimize(w1, n); } else { if (min(E1, E2, E3) == E1) w1[n] = W1_old - h; else if (min(E1, E2, E3) == E2) w1[n] = W1_old; else w1[n] = W1_old + h; Minimize(w1, n); } Листинг 3. Уменьшение шага h for (int q = 0; q <= N - 1; q++) { h = h / 2.0; for (int n = 0; n <= N - 1; n++) { Minimize(W1, n); W1[n] = result[n]; } } ----------------------------------------------------------------------------------------- Оценка построения индивидуальной траектории обучения английскому языку при помощи математических методов Шариков Д.В., Поваляев П.П., Егорова М.В. #include #pragma hdrstop #include "Unit1.h" #include "Unit2.h" #include "Unit3.h" #pragma package(smart_init) #pragma resource "*.dfm" TStartForm *StartForm; void __fastcall TStartForm::ExitButtonClick(TObject *Sender) { Close(); } void __fastcall TStartForm::AuthorButtonClick(TObject *Sender) { AuthorForm->ShowModal(); } void __fastcall TStartForm::StartButtonClick(TObject *Sender) { TestForm->ShowModal(); } void __fastcall TStartForm::HelpButtonClick(TObject *Sender) { ShowMessage (“Приложение представляет собой тренажер для прохождения экзаменов типа FCE. \nПользователю следует пройти задания в следующем порядке: Чтение (Reading), Грамматика (Grammar), Устная речь (Speaking), Применение языка (Use of English), Лексика (Vocabulary), Письмо (Writing). \nПо результатам выполнения заданий будет сформирована таблица, по значениям элементов которой строится индивидуальная траектория обучения.\nПо ней можно наглядно выявить, в каком направлении следует развивать навыки испытуемому.”); } #include #pragma hdrstop #include "Unit1.h" #include "Unit2.h" #include "Unit3.h" #include "Unit4.h" #pragma package(smart_init) #pragma resource "*.dfm" TTestForm *TestForm; int nOffset = 0, nBlockIdx = 0; int Correct[] = {0,1,3,1,1,3, 2,1,2,0,2,2, 3,0,1,1,3,2, 3,0,1,0,2,3, 3,1,0,3,2,1, 1,0,2,2,2,1} ; extern int A[36]; void __fastcall TTestForm::ExitButtonClick(TObject *Sender) { Close(); } void __fastcall TTestForm::TestButtonClick(TObject *Sender) { TestButton -> Visible = false; QuestLabel -> Caption = ("Read the text carefully, and for questions 1-6, choose the answer which you think fits best, according to the text. "); Image1 -> Picture ->LoadFromFile("task1.jpg"); Label1 -> Visible = true; RadioGroup1 ->Visible = true; Label2 -> Visible = true; RadioGroup2->Visible = true; Label3 -> Visible = true; RadioGroup3 ->Visible = true; Label4 -> Visible = true; RadioGroup4 ->Visible = true; Label5 -> Visible = true; RadioGroup5 ->Visible = true; Label6 -> Visible = true; RadioGroup6 ->Visible = true; } int rangeValue(int nFrom, int nTo) { return nFrom+random(nTo-nFrom+1); } void doRadioButton (TRadioGroup *nItem, TLabel *nLabelItem, int lOffset) { bool isCorrect = false; int nQuestionIdx = (int)lOffset*0.25; isCorrect = (nItem->ItemIndex == Correct[nQuestionIdx]); A[nQuestionIdx] = (isCorrect?rangeValue(8,10):rangeValue(1,7)); nItem->Items->Clear(); for (int i = lOffset; i < lOffset + 4; i++) { nItem->Items->Add(TestForm->Memo1->Lines->Strings[i]); } nLabelItem->Caption = TestForm->Memo2->Lines->Strings[nQuestionIdx]; //номер вопроса } void __fastcall TTestForm::Button1Click(TObject *Sender) { Button1->Enabled = false; TestForm->QuestLabel->Caption = TestForm->Memo3->Lines->Strings[nBlockIdx]; doRadioButton(RadioGroup1, Label1, nOffset); nOffset+=4; doRadioButton(RadioGroup2, Label2, nOffset); nOffset+=4; doRadioButton(RadioGroup3, Label3, nOffset); nOffset+=4; doRadioButton(RadioGroup4, Label4, nOffset); nOffset+=4; doRadioButton(RadioGroup5, Label5, nOffset); nOffset+=4; doRadioButton(RadioGroup6, Label6, nOffset); nOffset+=4; nBlockIdx++ if (nBlockIdx == 6) { Form4->ShowModal(); }} void __fastcall TTestForm::RadioGroup1Click(TObject *Sender) { Button1->Enabled = (RadioGroup1 ->ItemIndex != -1) && (RadioGroup2 ->ItemIndex != -1) && (RadioGroup3 ->ItemIndex != -1) && (RadioGroup4 ->ItemIndex != -1) && (RadioGroup5 ->ItemIndex != -1) && (RadioGroup6 ->ItemIndex != -1); } void __fastcall TTestForm::Button2Click(TObject *Sender) { Form4->ShowModal(); } ----------------------------------------------------------------------------------------- Разработка системы управления движением полевого агроробота Егорова М.В. 01. If (BoxDst is Close) and (BoxAngle is Right)and (FinDst is VeryClose) and (FinAngle is InFront)then (V is Stop)(w is TurnLeft) 02. If (BoxDst is Close) and (BoxAngle is Right)and (FinDst is Far) and (FinAngle is Right)then (V is Rear)(w is TurnLeft) 03. If (BoxDst is Close) and (BoxAngle is Right)and (FinDst is Far) and (FinAngle is Left)then (V is Rear)(w is TurnLeft) 04. If (BoxDst is Close) and (BoxAngle is Right)and (FinDst is Far) and (FinAngle is InFront)then (V is Rear)(w is TurnLeft) 05. If (BoxDst is Close) and (BoxAngle is Left)and (FinDst is VeryClose) and (FinAngle is Right)then (V is Rear)(w is TurnRight) 06. If (BoxDst is Close) and (BoxAngle is Right)and (FinDst is VeryClose) and (FinAngle is Left)then (V is Rear)(w is TurnLeft) 07. If (BoxDst is Close) and (BoxAngle is Right)and (FinDst is VeryClose) and (FinAngle is Right)then (V is Rear)(w is TurnRight) 08. If (BoxDst is Close) and (BoxAngle is Left)and (FinDst is VeryClose) and (FinAngle is Left)then (V is Rear)(w is TurnLeft) 09. If (BoxDst is Close) and (BoxAngle is Left)and (FinDst is VeryClose) and (FinAngle is InFront)then (V is Fast)(w is TurnRight) 10. If (BoxDst is Close) and (BoxAngle is Left)and (FinDst is Far) and (FinAngle is Right)then (V is Rear)(w is TurnRight) 11. If (BoxDst is Close) and (BoxAngle is Left)and (FinDst is Far) and (FinAngle is Left)then (V is Rear)(w is TurnRight) 12. If (BoxDst is Close) and (BoxAngle is Left)and (FinDst is Far) and (FinAngle is InFront)then (V is Rear)(w is TurnRight) 13. If (BoxDst is Close) and (BoxAngle is InFront)and (FinDst is VeryClose) and (FinAngle is Right)then (V is Stop)(w is TurnRight) 14. If (BoxDst is Close) and (BoxAngle is InFront)and (FinDst is VeryClose) and (FinAngle is Left)then (V is Stop)(w is TurnLeft) 15. If (BoxDst is Close) and (BoxAngle is InFront)and (FinDst is Far) and (FinAngle is Left)then (V is Rear)(w is TurnLeft) 16. If (BoxDst is Close) and (BoxAngle is InFront)and (FinDst is Far) and (FinAngle is Right)then (V is Rear)(w is TurnLeft) 17. If (BoxDst is Close) and (BoxAngle is InFront)and (FinDst is Far) and (FinAngle is InFront)then (V is Rear)(w is TurnLeft) 18. If (BoxDst is Far) and (BoxAngle is Right)and (FinDst is VeryClose) and (FinAngle is Right)then (V is Stop)(w is TurnRight) 19. If (BoxDst is Far) and (BoxAngle is Right)and (FinDst is VeryClose) and (FinAngle is Left)then (V is Stop)(w is TurnLeft) 20. If (BoxDst is Far) and (BoxAngle is Right)and (FinDst is VeryClose) and (FinAngle is InFront)then (V is Fast)(w is NoTurn) 21. If (BoxDst is Far) and (BoxAngle is Right)and (FinDst is Far) and (FinAngle is Right)then (V is Fast)(w is TurnRight) 22. If (BoxDst is Far) and (BoxAngle is Right)and (FinDst is Far) and (FinAngle is Left)then (V is Fast)(w is TurnLeft) 23. If (BoxDst is Far) and (BoxAngle is Right)and (FinDst is Far) and (FinAngle is InFront)then (V is Fast)(w is NoTurn) 24. If (BoxDst is Far) and (BoxAngle is Left)and (FinDst is VeryClose) and (FinAngle is Right)then (V is Stop)(w is TurnRight) 25. If (BoxDst is Far) and (BoxAngle is Left)and (FinDst is VeryClose) and (FinAngle is Left)then (V is Stop)(w is TurnLeft) 26. If (BoxDst is Far) and (BoxAngle is Left)and (FinDst is VeryClose) and (FinAngle is InFront)then (V is Fast)(w is NoTurn) 27. If (BoxDst is Far) and (BoxAngle is Left)and (FinDst is Far) and (FinAngle is Right)then (V is Fast)(w is TurnRight) 28. If (BoxDst is Far) and (BoxAngle is Left)and (FinDst is Far) and (FinAngle is Left)then (V is Fast)(w is TurnLeft) 29. If (BoxDst is Far) and (BoxAngle is Left)and (FinDst is Far) and (FinAngle is InFront)then (V is Fast)(w is NoTurn) 30. If (BoxDst is Far) and (BoxAngle is InFront)and (FinDst is VeryClose) and (FinAngle is Right)then (V is Stop)(w is TurnRight) 31. If (BoxDst is Far) and (BoxAngle is InFront)and (FinDst is VeryClose) and (FinAngle is Left)then (V is Stop)(w is TurnLeft) 32. If (BoxDst is Far) and (BoxAngle is InFront)and (FinDst is VeryClose) and (FinAngle is InFront)then (V is Fast)(w is NoTurn) 33. If (BoxDst is Far) and (BoxAngle is InFront)and (FinDst is Far) and (FinAngle is Right)then (V is Fast)(w is TurnRight) 34. If (BoxDst is Far) and (BoxAngle is InFront)and (FinDst is Far) and (FinAngle is Left)then (V is Fast)(w is TurnLeft) 35. If (BoxDst is Far) and (FinDst is Far)and (FinAngle is Right) then (V is Fast)(w is TurnRight) 36. If (BoxDst is Far) and (FinDst is Far)and (FinAngle is Left) then (V is Fast)(w is TurnLeft) 37. If (BoxDst is Far) and (FinDst is Far)and (FinAngle is InFront) then (V is Fast)(w is NoTurn) public class Robot { public float x; public float y; public int width; public int height; public double course; } public class Obstacle { public float x; public float y; public double turnAngle; public double width; public double height; } public void fuzzyfication() { bClose = trapmf(boxDist, -2.045, -1.155, 1.97, 3.025); bFar = smf(boxDist, 2.045, 3.025); … bRight = trapmf(boxAngle, -1.57, -1.0, -0.4, -0.1577); bInFront = trapmf(boxAngle, -0.4, -0.17, 0.17, 0.4); bLeft = trapmf(boxAngle, 0.1577, 0.4, 1.0, 1.57); … fClose = trapmf(finDist, -0.0002, -0.0001, 1.54, 2.39); fFar = smf(finDist, 1.5, 2.315); … fRight = gauss2mf(finAngle, 0.267, -3.77, 0.18541, -0.3483); fInFront = trapmf(finAngle, -0.244, -0.1237, 0.1237, 0.244); fLeft = gauss2mf(finAngle, 0.18541, 0.3483, 0.267, 3.77); … } private void createrules() { R0 = new double[,] { { bClose, bRight, fVeryClose, fInFront }, { bClose, bRight, fVeryClose, fRight }, { bClose, bRight, fVeryClose, fLeft }, { bClose, bRight, fFar, fInFront }, { bClose, bRight, fFar, fRight }, { bClose, bRight, fFar, fLeft }, … R1 = new byte[,] { { 1,2 }, { 1,0 }, { 2,2 }, { 2,2 }, { 1,2 }, { 1,2 }, … } private void aggregation() { for (int i = 0; i < R2.Length; i++) { R2[i] = R0[i, 0]; for (int j = 1; j < 4; j++) { R2[i] = Math.Min(R2[i], R0[i, j]); } } } private void defuzzyfication() { for (int i = 0; i < R2.Length; i++) { switch (R1[i, 0]) { case 0: tmpVal = _trapmf(R2[i], -0.9613, -0.901, -0.361, 0.1); … } switch (R1[i, 1]) { case 0: lw[i] = _trimf(R2[i], -2.1, -2, -0.4); break; … } } for (int i = 0; i < R2.Length; i++) { tmpVal += R2[i] * lw[i]; } w = tmpVal / R2.Sum(); … } -----------------------------------------------------------------------------------------