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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.