📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, ExtCtrls, XPMan;
type
TForm1 = class(TForm)
SG: TStringGrid;
Label1: TLabel;
E1: TEdit;
Button1: TButton;
Shape1: TShape;
Timer1: TTimer;
XPManifest1: TXPManifest;
Label2: TLabel;
Button2: TButton;
Label3: TLabel;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Show_C(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
step=19;
n=20;
var
Form1: TForm1;
flag: Boolean;
argw: string[n];
temparg: string[n];
for_exit: string[2];
state,i: byte;
symbol: char;
st:integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
sg.Cells[1,0]:='q0';
sg.Cells[2,0]:='q1';
sg.Cells[3,0]:='qz';
sg.Cells[0,1]:='0';
sg.Cells[0,2]:='1';
sg.Cells[0,3]:='2';
sg.Cells[0,4]:='3';
sg.Cells[0,5]:='4';
sg.Cells[0,6]:='5';
sg.Cells[0,7]:='6';
sg.Cells[0,8]:='7';
sg.Cells[0,9]:='8';
sg.Cells[0,10]:='9';
sg.Cells[0,11]:='#';
sg.Cells[2,1]:='1 qz';
sg.Cells[2,2]:='2 qz';
sg.Cells[2,3]:='3 qz';
sg.Cells[2,4]:='4 qz';
sg.Cells[2,5]:='5 qz';
sg.Cells[2,6]:='6 qz';
sg.Cells[2,7]:='7 qz';
sg.Cells[2,8]:='8 qz';
sg.Cells[2,9]:='9 qz';
sg.Cells[2,10]:='0 q1 L';
sg.Cells[2,11]:='1 qz';
sg.Cells[1,1]:='0 q0 R';
sg.Cells[1,2]:='1 q0 R';
sg.Cells[1,3]:='2 q0 R';
sg.Cells[1,4]:='3 q0 R';
sg.Cells[1,5]:='4 q0 R';
sg.Cells[1,6]:='5 q0 R';
sg.Cells[1,7]:='6 q0 R';
sg.Cells[1,8]:='7 q0 R';
sg.Cells[1,9]:='8 q0 R';
sg.Cells[1,10]:='9 q0 R';
sg.Cells[1,11]:='# q1 L';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
flag:=true;
state:=0;
argw:='#'+E1.Text+'#';
Label2.Caption:=argw;
Shape1.Visible:=true;
Shape1.Top:=168;
Shape1.Left:=360;
Timer1.Enabled:=true;
st:=2;
end;
procedure TForm1.Show_C(Sender: TObject);
var
len,j:integer;
begin
len:=0;
temparg:='';
symbol:=argw[st];
if symbol in ['0'..'9'] then i:=strtoint(symbol)+1
else i:=11;
temparg:=sg.Cells[state+1,i];
len:=length(temparg);
argw[st]:=temparg[1];
for j:=1 to len do
begin
//if temparg[j] in ['#','0'..'9'] then argw[st]:=temparg[j];
if ((temparg[j]='q') and (temparg[j+1]in ['0','1'])) then state:=strtoint(temparg[j+1]);
if temparg[j]='z' then flag:=false;
if temparg[j]='R' then
begin
Shape1.Left:=Shape1.Left+step;
inc(st);
end
else
if temparg[j]='L' then
begin
Shape1.Left:=Shape1.Left-step;
dec(st);
end;
end;
Label2.Caption:=argw;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if flag then Show_C(self);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label2.Caption:='';
Shape1.Visible:=false;
Timer1.Enabled:=false;
E1.Text:='';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -