Форум программистов

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Форум программистов (https://programmersforum.ru/index.php)
-   Общие вопросы Delphi (https://programmersforum.ru/forumdisplay.php?f=2)
-   -   Создаю видеокурс по созданию "клеточного автомата" на дельфи. Математическая модель общества (https://programmersforum.ru/showthread.php?t=326513)

anaschu 08.02.2019 16:40

черновая видюшка того, как идет процесс создания учебных макетов
https://youtu.be/nIF4dtiFLI4

черновой код
Код:


       
Код:

       
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm2 = class(TForm)
    StringGrid1: TStringGrid;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);//; ACol, ARow: Integer;   Rect: TRect; State: TGridDrawState);
    procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);

  private
    { Private declarations }
    maxRes: integer;

    procedure fillStiringGrid(var sg: TStringGrid;
                              rowCount, colCount, maxValue: integer);
  public
    { Public declarations }
  end;

var
  Form2: TForm2;




implementation

{$R *.dfm}
procedure TForm2.fillStiringGrid(var sg: TStringGrid;
                              rowCount, colCount, maxValue: integer);
var
  i, j: integer;
begin
  sg.RowCount:=rowCount;
  sg.ColCount:=colCount;
  rowCount := 100;
  // Создаем объекты клеток.
  Randomize;
  for i := 0 to StringGrid1.RowCount-1 do
  begin
    for j := 0 to StringGrid1.ColCount-1 do
    begin
      sg.Cells[i, j]:=inttostr(Random(maxValue));
    end;
  end;

end;

procedure TForm2.Button1Click(Sender: TObject {ACol, ARow: Integer;   Rect: TRect; State: TGridDrawState});
 var
 i, j: Integer;
 res:integer;
begin
  i := 10;
  fillStiringGrid(StringGrid1, i, 10, 2);

 //закрашиваем ячейку

// находим максимальное значение


i:=0;
j:=0;


  res:= strtoint(StringGrid1.Cells[3, 3]);
  for i := 3 to 5 do
    for j := 3 to 5 do
    begin
       if (res<strtoint(StringGrid1.Cells[i, j])) and ( (i<>4) and (j<>4)) then
         res:= strtoint(StringGrid1.Cells[i, j]);
    end;
  maxRes := res;
   // собираем массив возможных направлений роста

  { for i := 3 to 5 do
      for j := 3 to 5 do
        begin
         if (i<>4) or (j<>4) then
            if (res = strtoint(StringGrid1.Cells[i, j]))  then
              begin
               StringGrid1.Canvas.Brush.Color:=clRed;
               if ((ACol=i)and(ARow=j)) then
                  StringGrid1.Canvas.FillRect(Rect);
              end;
        end;  }

       { StringGrid1.Cells(ACol, Arow)   }






end;



{procedure TForm2.Grow(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var
i,j,res:integer;

begin
// находим максимальное значение
res:=0;
    for i := 3 to 5 do
      for j := 3 to 5 do
        begin
         if (i<>4) or (i<>4) then

         res:= strtoint(StringGrid1.Cells[i, j]);
         if res<strtoint(StringGrid1.Cells[i, j]) then  res:= strtoint(StringGrid1.Cells[i, j]);


        end;
   // собираем массив возможных направлений роста

   for i := 3 to 5 do
      for j := 3 to 5 do
        begin
         if (i<>4) or (i<>4) then
            if (res = strtoint(StringGrid1.Cells[i, j]))  then
              begin
               StringGrid1.Canvas.Brush.Color:=clRed;
               if ((ACol=i)and(ARow=j)) then
                  StringGrid1.Canvas.FillRect(Rect);
              end;





  end;
end;  }

procedure TForm2.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
  text: string;
begin

  StringGrid1.Canvas.Brush.Color:=clRed;
  if ((ACol=4)and(ARow=4) and (StringGrid1.Cells[ACol, ARow]<>'')) then
    StringGrid1.Canvas.FillRect(Rect);
  if StringGrid1.Cells[ACol, ARow] = '' then exit;

  if (abs(ACol - 4) <= 1) and (abs(ARow-4) <= 1) and ((Acol <> 4) or (ARow<>4))
     and (StrToInt(StringGrid1.Cells[ACol, ARow]) = maxRes) then begin
       StringGrid1.Canvas.Brush.Color:=clGreen;
       StringGrid1.Canvas.Font.Color := clWhite;
       StringGrid1.Canvas.FillRect(Rect);
       text := StringGrid1.Cells[ACol, ARow];
       DrawText(StringGrid1.Canvas.Handle,
       PChar(text), Length(text), Rect, DT_CENTER or DT_VCENTER or DT_SINGLELINE);
     end;


end;


{procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
   if StringGrid1.Cells[ACol,ARow]<>'' then
    begin
     if StrToInt(StringGrid1.Cells[ACol,ARow])>=50 then
      begin
       StringGrid1.Canvas.Brush.Color:=clRed;
       StringGrid1.Canvas.FillRect(Rect);
       StringGrid1.Canvas.TextOut(Rect.Left,Rect.Top,StringGrid1.Cells[Acol,Arow]);
      end;
     end;
   if StringGrid1.Cells[ACol,ARow]<>'' then
    begin
     if StrToInt(StringGrid1.Cells[ACol,ARow])<=10 then
      begin
       StringGrid1.Canvas.Brush.Color:=clGreen;
       StringGrid1.Canvas.FillRect(Rect);
       StringGrid1.Canvas.TextOut(Rect.Left,Rect.Top,StringGrid1.Cells[Acol,Arow]);
      end;
     end;
   if StringGrid1.Cells[ACol,ARow]<>'' then
    begin
     if (StrToInt(StringGrid1.Cells[ACol,ARow])>10)
        and (StrToInt(StringGrid1.Cells[ACol,ARow])<50) then
      begin
       StringGrid1.Canvas.Brush.Color:=clYellow;
       StringGrid1.Canvas.FillRect(Rect);
       StringGrid1.Canvas.TextOut(Rect.Left,Rect.Top,StringGrid1.Cells[Acol,Arow]);
      end;
     end;
end;}

procedure TForm2.StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
  var CanSelect: Boolean);
  var

  Resources: String;
begin
Resources := StringGrid1.Cells[ACol, ARow];
Label1.Caption:='Число ресурсов: '+Resources;

end;

end.




anaschu 08.02.2019 19:04

Цитата:

Сообщение от Alex11223 (Сообщение 1768763)
А что выводят-то?

по гиту проблемы выводит. В папке 6 в ветке 670143b я сделал сегодня норм код, решил слить с веткой мастер и никак...
Наверное, я не в ту ветку встал для мерджа. Надо было встать из 670143b в мастер и потом слить мастаер с 670143b
А я пытаюсь делать наоборот и в 670143b вливать мастер, хотя в мастере у меня старый код.
Гит не может позволить мне такого сделать))))
Теперь вопрос, как сделать так, что бы он забыл о моем неблаговидном поступке. Сделать так, как будто никакого мерджа и не было.

Ximikadze@Ximikadze-PC MINGW64 /d/forgit/сourse/Code/06 ((670143b...))
$ git merge master
warning: Cannot merge binary files: Code/06/Lesson06.res (HEAD vs. master)
Auto-merging Code/06/Unit2.pas
CONFLICT (content): Merge conflict in Code/06/Unit2.pas
Auto-merging Code/06/Unit2.dfm
Removing Code/06/Project2.dproj.local
Auto-merging Code/06/Lesson06.res
CONFLICT (add/add): Merge conflict in Code/06/Lesson06.res
Auto-merging Code/06/Lesson06.dproj
CONFLICT (add/add): Merge conflict in Code/06/Lesson06.dproj
Automatic merge failed; fix conflicts and then commit the result.

Ximikadze@Ximikadze-PC MINGW64 /d/forgit/сourse/Code/06 ((670143b...)|MERGING)
$ git checkout ^C

Ximikadze@Ximikadze-PC MINGW64 /d/forgit/сourse/Code/06 ((670143b...)|MERGING)
$ git merge master
error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

Ximikadze@Ximikadze-PC MINGW64 /d/forgit/сourse/Code/06 ((670143b...)|MERGING)
$ git checkout master
error: you need to resolve your current index first
Code/06/Lesson06.dproj: needs merge
Code/06/Lesson06.res: needs merge
Code/06/Unit2.pas: needs merge

Alex11223 08.02.2019 19:09

В GUI клиентах обычно слияние довольно интуитивно происходит, по крайней мере в GitKraken.

А так для начала в любой непонятной ситуации надо начинать с git status

anaschu 08.02.2019 19:11

мне нужно решить вопрос по гиту.
Но у меня тут ветка делфи. Как можно верхний пост перенести на ветку по гиту, что бы при этом авто сохранилась связь с этой веткой? бывают ли такие возможности на форуме? А вообще попробую пройти курс на code academi по гиту.
По питону я весь бесплатный почти прошел. застопорился на задании, где надо было сделать игру "камень ножницы бумага"

anaschu 08.02.2019 19:17

Цитата:

Сообщение от Alex11223 (Сообщение 1768938)
В GUI клиентах обычно слияние довольно интуитивно

я пробовал в смартГит сначала. не вышло. потом перешл в гит гуи. там вообще все испортил

anaschu 09.02.2019 16:17

Программа курса
 
Вложений: 1
Добавил план всего курса.
https://gitlab.com/septic-mushroom/l...6befa731f7cf73
Теперь для примера надо будет добавить план одного урока. Не обязательно с начала, с начала там уж совсем для школьников младших.

anaschu 09.02.2019 16:17

Цитата:

Сообщение от anaschu (Сообщение 1768941)
там вообще все испортил

теперь придеться что то типа хард резет делать

anaschu 10.02.2019 14:14

Вложений: 1
придеться делать новую гит папку или что то такое, что ли...пока не разобрался с гит резет.
Но написал план урока №7, который я буду особенно серьезно разрабатывать, это будет визитная карточка куhcа

anaschu 11.02.2019 18:18

Вложений: 1
вот как то так

anaschu 11.02.2019 20:15

поправил проблему с гитом


00:12.