- 1
- 2
- 3
- 4
- 5
for (k = k + 0, j = 0; j < m; j++)
{
b[k] = mat[i][j];
cout << b[k];
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
for (k = k + 0, j = 0; j < m; j++)
{
b[k] = mat[i][j];
cout << b[k];
}
Увидел в лабе у чела из универа. Почему бы лишний раз не присвоить k собственное значение
0
/* https://github.com/v7unix/v7unix/blob/ed636a47207476db76d53b7869447889dee3bbad/v7/usr/src/cmd/sh/mac.h */
#
/*
* UNIX shell
*
* S. R. Bourne
* Bell Telephone Laboratories
*
*/
#define LOCAL static
#define PROC extern
#define TYPE typedef
#define STRUCT TYPE struct
#define UNION TYPE union
#define REG register
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}
#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
#define DO ){
#define OD ;}
#define REP do{
#define PER }while(
#define DONE );
#define LOOP for(;;){
#define POOL }
#define SKIP ;
#define DIV /
#define REM %
#define NEQ ^
#define ANDF &&
#define ORF ||
#define TRUE (-1)
#define FALSE 0
#define LOBYTE 0377
#define STRIP 0177
#define QUOTE 0200
#define EOF 0
#define NL '\n'
#define SP ' '
#define LQ '`'
#define RQ '\''
#define MINUS '-'
#define COLON ':'
#define MAX(a,b) ((a)>(b)?(a):(b))
0
Let's count a number of rules that can be built in GoL-like automatas. Rule is the matrix that maps some condition of cells to new state.
Cell itself could be alive or dead. And cell could have 0-8 neighbors. So, there are 2^(2*9) = 262144 different rules. Well known, that
the majority of them are primitive and produces some pure pattern or just dies in finite number of generations / infinitely fills the world
with alive cells. We also know that some rules are symmetric to each other as if we just rename (swap colors of) alive and dead cells.
Conway found the most interesting rule from entropy point of view.
2^18 is not so much. Let's take a look at 2D automata known as Rule 110. State 100 keeps cell dead:
100 -> 0
While state 001 makes cell alive:
001 -> 1
In terms of neighborhood, this two rules are indifferent: both means one live neighbor next to dead cell. But in Rule 110 not only a /number/
of neighbors is meaningful, but the /position/ of separate neighbor.
Let's imagine the GoL-like rule with the same property: we will look not only at number of neighbors, but at their position. What if to have one
neighbor at north-west gives not the same result as if neighbor were at south-east.
This change gives us much more different rules. If each neighbor is meaningful, then we have 2 ^ 8 different states of neighborhood, and cell
could be still alive or dead. If I'm not wrong there must be 2 ^ (2 * (2 ^ 8)) = 2 ^ 512 different rules.
Obviously, this space includes Conway's Game of Life and all different rules from that 262144, and gives billions of new ones. Obviously,
the majority of them are trivial too. But there may be some interesting entropy-like rules different from the Conway's one.
This space is too huge to be discovered manually, and even with bruteforce algorithms too. But evolution algorithms could be used to find rules
with some special properties.
So, I have two questions:
1) Does this space has a given name, anybody researched that?
2) I will be glad to hear any ideas on how to make this space simpler by excluding symmetric states etc. to save the time for discovering.
Any cellular nerds here?
0
#include <string>
#include <iostream>
int foo() {
std::string str = "file://*";
std::cout << str << std::endl;
return 0;
}
/*
int bar() {
std::string str = "file://*"; // warning: '/*' within block comment [-Wcomment]
std::cout << str << std::endl;
return 0;
}
*/
int main() {
foo();
//bar();
}
Какой багор
https://ideone.com/NiXH2q
0
class UserCreate(MethodView):
"""Data create."""
def post(self):
"""Создание данных."""
q = 1
values = {}
values['person'] = request.json_schema["person"]
values['date_opr'] = request.json_schema["dateOpr"]
values['year_input'] = request.json_schema["yearInput"]
values['vuz'] = request.json_schema["vuz"]
values['person_id'] = request.json_schema["personId"]
q = 1
with session_scope() as session:
id = candidate_service.create_item(session, values)
return {"msg": "Данные созданы", "data": {"id": id}}
зачем эта переменная q???
0
// https://github.com/x42/darc.lv2/blob/7f1f42b879777e570c83fd566ac28cbfdd51e6fc/src/lv2.c#L508
static void
create_pattern (Darc* self, const double w)
{
const int x0 = floor (w * 0.05);
const int x1 = ceil (w * 0.95);
const int wd = x1 - x0;
#define DEF(x) ((x0 + wd * ((x) + 20.) / 60.) / w)
cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, w, 0);
/* clang-format off */
cairo_pattern_add_color_stop_rgba (pat, 1.0, .0, .5, .0, 0);
cairo_pattern_add_color_stop_rgba (pat, DEF (40), .0, .5, .0, 0.5);
cairo_pattern_add_color_stop_rgba (pat, DEF (5), .0, .5, .0, 0.5);
cairo_pattern_add_color_stop_rgba (pat, DEF (-5), .5, .0, .0, 0.5);
cairo_pattern_add_color_stop_rgba (pat, DEF (-20), .5, .0, .0, 0.5);
cairo_pattern_add_color_stop_rgba (pat, 0.0, .5, .0, .0, 0);
/* clang-format on */
self->mpat = pat;
pat = cairo_pattern_create_linear (0.0, 0.0, w, 0);
/* clang-format off */
cairo_pattern_add_color_stop_rgba (pat, 1.0, .1, .9, .1, 0);
cairo_pattern_add_color_stop_rgba (pat, DEF (40), .1, .9, .1, 1);
cairo_pattern_add_color_stop_rgba (pat, DEF (5), .1, .9, .1, 1);
cairo_pattern_add_color_stop_rgba (pat, DEF (-5), .9, .9, .1, 1);
cairo_pattern_add_color_stop_rgba (pat, DEF (-20), .9, .9, .1, 1);
cairo_pattern_add_color_stop_rgba (pat, 0.0, .9, .9, .1, 0);
/* clang-format on */
self->cpat = pat;
#undef DEF
}
Отключаем и включаем clang-формат, чтобы отступы красиво были. Да еще и такой вот локальный дефайн!
−1
function ReplaceHTMLSpec(First, Last, RepTo, RepEd:string):string;
var
I, P, St:Integer;
SS, Temp:string;
begin
Temp:='';
ST:=0;
while True do
begin
P:=Pos(First, Result);
if P = 0 then Break;
SS:=Copy(Result, ST, P-1)+RepTo;
Temp:=Temp+SS;
ST:=P+Length(First);
Result:=Copy(Result, ST, MaxInt);
P:=Pos(Last, Result);
if P > 0 then
begin
SS:=Copy(Result, 1, P-1)+RepEd;
Temp:=Temp+SS;
ST:=P+Length(Last);
SS:=Copy(Result,ST, MaxInt);
Temp:=Temp+SS;
end;
Result:=Temp;
end;
end;
function DecorateText(S:string):string;
const
Arr:array[0..3] of string=('<br>','"','<','>');
var
I, P, St:Integer;
SS, Temp:string;
begin
Result:=S;
for I:=0 to 3 do
Result:=StringReplace(Result, Arr[I], '',[rfreplaceall]);
Result:=StringReplace(Result,'<br />',#13#10,[rfreplaceall]);
Result:=StringReplace(Result,'<i>','[i]',[rfreplaceall]);
Result:=StringReplace(Result,'</i>','[/i]',[rfreplaceall]);
Result:=StringReplace(Result,'<b>','[b]',[rfreplaceall]);
Result:=StringReplace(Result,'</b>','[/b]',[rfreplaceall]);
Temp:='';
ST:=0;
{ while True do
begin
P:=Pos('<span style="font-size:10px;">', Result);
if P = 0 then Break;
SS:=Copy(Result, ST, P-1)+'[size=10]';
Temp:=Temp+SS;
ST:=P+Length('<span style="font-size:10px;">');
Result:=Copy(Result, ST, MaxInt);
P:=Pos('</span>', Result);
if P > 0 then
begin
SS:=Copy(Result, 1, P-1)+'[/size]';
Temp:=Temp+SS;
ST:=P+Length('</span>');
SS:=Copy(Result,ST, MaxInt);
Temp:=Temp+SS;
Result:=Temp;
end;
end; }
Result:=ReplaceHTMLSpec('<span style="color:white;">','</span>','[color=white]','[/color]');
Result:=ReplaceHTMLSpec('<span style="color:red;">','</span>','[color=red]','[/color]');
Result:=ReplaceHTMLSpec('<span style="color:blue;">','</span>','[color=blue]','[/color]');
Result:=ReplaceHTMLSpec('<span style="color:green;">','</span>','[color=green]','[/color]');
Result:=ReplaceHTMLSpec('<pre><code class="">','</code></pre>','[code]','[/code]');
Result:=ReplaceHTMLSpec('<span style="font-size:10px;">','</span>','[size=10]','[/size]');
Result:=ReplaceHTMLSpec('<span style="font-size:15px;">','</span>','[size=15]','[/size]');
Result:=ReplaceHTMLSpec('<span style="font-size:20px;">','</span>','[size=20]','[/size]');
Result:=ReplaceHTMLSpec('<span style="text-decoration:underline;">','</span>','[u]','[/u]');
Result:=ReplaceHTMLSpec('<span style="text-decoration:line-through;">','</span>','[s]','[/s]');
Result:=ReplaceHTMLSpec('<span style="text-decoration:blink;">','</span>','[blink]','[/blink]');
end;
Пахнет селёдкой. Ой блять, забыл подмыться.
0
Время вечерней молитвы.
Примите положение А1. Постарайтесь сосредоточиться, соберитесь с мыслями. Прочтите молитву.
Инициализируйте процедуру-коллбек.
0
Application was halted by an exception.
Error 520
Ray ID: 69e3d61cfd95169b •
2021-10-14 21:18:17 UTC
Web server is returning an unknown error
You
Browser Working
Moscow
Cloudflare Working
govnokod.ru
Host Error
What happened?
There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed.
What can I do?
If you are a visitor of this website:
Please try again in a few minutes.
If you are the owner of this website:
There is an issue between Cloudflare's cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team. Please include the Ray ID (which is at the bottom of this error page). Additional troubleshooting resources.
Cloudflare Ray ID: 69e3d61cfd95169b
Your IP: 91.197.11.236
Performance & security by Cloudflare
0
function main4() {
let i = 0;
try {
try {
throw 1.0;
}
catch (e: number) {
i++;
print("asd1");
throw 2.0;
}
finally {
print("finally");
}
}
catch (e2: number) {
i++;
print("asd3");
}
assert(i == 2);
}
function main() {
main4();
print("done.");
}
Ну вот и все.. шах и мат С/C++ девелоперы... последняя хитровые...аная инструкция finally сделана. (надо еще для линуха сделать .. а то они разные)