Changeset 59 for trunk/Forms


Ignore:
Timestamp:
Sep 26, 2014, 12:05:30 AM (10 years ago)
Author:
chronos
Message:
  • Added: Move win probability calculation.
  • Fixed: Attack processing to be same as Risk game system.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMove.lfm

    r42 r59  
    11object FormMove: TFormMove
    2   Left = 770
     2  Left = 435
    33  Height = 257
    4   Top = 484
     4  Top = 165
    55  Width = 320
    66  ActiveControl = ButtonOk
     
    88  ClientHeight = 257
    99  ClientWidth = 320
     10  OnCreate = FormCreate
    1011  OnShow = FormShow
    11   LCLVersion = '1.3'
     12  LCLVersion = '1.0.10.0'
    1213  object SpinEditOnce: TSpinEdit
    1314    Left = 208
    14     Height = 32
    15     Top = 16
     15    Height = 27
     16    Top = 32
    1617    Width = 98
    1718    OnChange = SpinEditOnceChange
     
    2021  object Label1: TLabel
    2122    Left = 24
    22     Height = 22
    23     Top = 16
    24     Width = 46
     23    Height = 18
     24    Top = 32
     25    Width = 36
    2526    Caption = 'Once:'
    2627    ParentColor = False
     
    2930    Left = 184
    3031    Height = 25
    31     Top = 208
     32    Top = 224
    3233    Width = 75
    3334    Caption = 'Ok'
     
    3940    Left = 72
    4041    Height = 25
    41     Top = 208
     42    Top = 224
    4243    Width = 75
    4344    Caption = 'Cancel'
     
    4748  object Label2: TLabel
    4849    Left = 24
    49     Height = 22
    50     Top = 120
    51     Width = 87
     50    Height = 18
     51    Top = 136
     52    Width = 66
    5253    Caption = 'Every turn:'
    5354    ParentColor = False
     
    5556  object SpinEditRepeat: TSpinEdit
    5657    Left = 208
    57     Height = 32
    58     Top = 112
     58    Height = 27
     59    Top = 128
    5960    Width = 98
    6061    OnChange = SpinEditRepeatChange
     
    6465    Left = 56
    6566    Height = 43
    66     Top = 55
     67    Top = 71
    6768    Width = 208
    6869    OnChange = TrackBarOnceChange
     
    7677    Left = 56
    7778    Height = 43
    78     Top = 152
     79    Top = 168
    7980    Width = 208
    8081    OnChange = TrackBarRepeatChange
     
    8889    Left = 8
    8990    Height = 25
    90     Top = 64
     91    Top = 80
    9192    Width = 48
    9293    Caption = 'Min'
    93     OnClick = uttonOnceMinClick
     94    OnClick = ButtonOnceMinClick
    9495    TabOrder = 6
    9596  end
     
    9798    Left = 264
    9899    Height = 25
    99     Top = 64
     100    Top = 80
    100101    Width = 48
    101102    Anchors = [akTop, akRight]
     
    107108    Left = 8
    108109    Height = 25
    109     Top = 160
     110    Top = 176
    110111    Width = 48
    111112    Caption = 'Min'
     
    116117    Left = 264
    117118    Height = 25
    118     Top = 160
     119    Top = 176
    119120    Width = 48
    120121    Anchors = [akTop, akRight]
     
    123124    TabOrder = 9
    124125  end
     126  object Label3: TLabel
     127    Left = 16
     128    Height = 18
     129    Top = 8
     130    Width = 96
     131    Caption = 'Win probability:'
     132    ParentColor = False
     133  end
     134  object LabelWinProbability: TLabel
     135    Left = 232
     136    Height = 18
     137    Top = 8
     138    Width = 10
     139    Caption = '   '
     140    ParentColor = False
     141  end
    125142end
  • trunk/Forms/UFormMove.lrt

    r42 r59  
    88TFORMMOVE.BUTTONREPEATMIN.CAPTION=Min
    99TFORMMOVE.BUTTONREPEATMAX.CAPTION=Max
     10TFORMMOVE.LABEL3.CAPTION=Win probability:
     11TFORMMOVE.LABELWINPROBABILITY.CAPTION=   
  • trunk/Forms/UFormMove.pas

    r42 r59  
    2222    Label1: TLabel;
    2323    Label2: TLabel;
     24    Label3: TLabel;
     25    LabelWinProbability: TLabel;
    2426    SpinEditOnce: TSpinEdit;
    2527    SpinEditRepeat: TSpinEdit;
     
    2830    procedure ButtonOnceMaxClick(Sender: TObject);
    2931    procedure ButtonRepeatMinClick(Sender: TObject);
    30     procedure uttonOnceMinClick(Sender: TObject);
     32    procedure FormCreate(Sender: TObject);
     33    procedure ButtonOnceMinClick(Sender: TObject);
    3134    procedure ButtonRepeatMaxClick(Sender: TObject);
    3235    procedure FormShow(Sender: TObject);
     
    3841    { private declarations }
    3942  public
    40     { public declarations }
     43    DefendCount: Integer;
     44    procedure UpdateView;
    4145  end;
    4246
     
    4751
    4852{$R *.lfm}
     53
     54uses
     55  UCore;
    4956
    5057{ TFormMove }
     
    6269end;
    6370
     71procedure TFormMove.UpdateView;
     72begin
     73  LabelWinProbability.Caption :=
     74    IntToStr(Round(Core.Game.AttackProbability(SpinEditOnce.Value,
     75    DefendCount) * 100)) + ' %';
     76end;
     77
    6478procedure TFormMove.SpinEditOnceChange(Sender: TObject);
    6579begin
    6680  if SpinEditOnce.Value <> TrackBarOnce.Position then
    6781    TrackBarOnce.Position := SpinEditOnce.Value;
     82  UpdateView;
    6883end;
    6984
     
    7186begin
    7287  ButtonOk.SetFocus;
     88  UpdateView;
    7389end;
    7490
     
    8399end;
    84100
    85 procedure TFormMove.uttonOnceMinClick(Sender: TObject);
     101procedure TFormMove.FormCreate(Sender: TObject);
     102begin
     103
     104end;
     105
     106procedure TFormMove.ButtonOnceMinClick(Sender: TObject);
    86107begin
    87108  TrackBarOnce.Position := TrackBarOnce.Min;
Note: See TracChangeset for help on using the changeset viewer.