Changeset 109


Ignore:
Timestamp:
Dec 10, 2024, 10:38:11 AM (5 weeks ago)
Author:
chronos
Message:
  • Modified: Added more score information.
  • Fixed: Record only non-zero scores.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Board.pas

    r105 r109  
    2020    procedure Clear;
    2121    procedure ClearMerged;
     22    function GetBiggestTile: Integer;
    2223    function GetValueSum: Integer;
    2324    function GetHighestTileValue: Integer;
     
    122123end;
    123124
     125function TBoard.GetBiggestTile: Integer;
     126var
     127  X, Y: Integer;
     128begin
     129  Result := 0;
     130  for Y := 0 to Size.Y - 1 do
     131    for X := 0 to Size.X - 1 do
     132      if not Tiles[Y, X].Disabled and
     133      not Tiles[Y, X].Unmergeable and
     134      (Tiles[Y, X].Value > Result) then Result := Tiles[Y, X].Value;
     135end;
     136
    124137function TBoard.GetValueSum: Integer;
    125138var
  • trunk/Core.pas

    r108 r109  
    275275  Score: TScore;
    276276begin
     277  if Game.Score = 0 then Exit;  // Do not record zero score
     278
    277279  Score := Scores.SearchByTime(Game.StartTime);
    278280  if not Assigned(Score) then Score := Scores.AddNew;
     
    282284  Score.UsedUndos := Game.UsedUndos;
    283285  Score.BoardSize := IntToStr(Game.Board.Size.X) + 'x' + IntToStr(Game.Board.Size.Y);
     286  Score.DisabledTiles := Game.DisabledTilesCount;
     287  Score.UnmergeableTiles := Game.UnmergeableTilesCount;
     288  Score.Duration := Now - Game.StartTime;
     289  Score.BiggestTile := Game.Board.GetBiggestTile;
    284290end;
    285291
  • trunk/Forms/FormScore.lfm

    r108 r109  
    2222      end   
    2323      item
     24        Caption = 'Board size'
     25        Width = 100
     26      end   
     27      item
    2428        Caption = 'Score'
     29        Width = 100
     30      end   
     31      item
     32        Caption = 'Biggest tile'
    2533        Width = 100
    2634      end   
     
    3442      end   
    3543      item
    36         Caption = 'Board size'
    37         Width = 101
     44        Caption = 'Disabled tiles'
     45        Width = 100
     46      end   
     47      item
     48        Caption = 'Unmergeable tiles'
     49        Width = 100
     50      end   
     51      item
     52        Caption = 'Duration'
     53        Width = 100
    3854      end>
    3955    OwnerData = True
  • trunk/Forms/FormScore.lrj

    r108 r109  
    22{"hash":5875333,"name":"tformscore.caption","sourcebytes":[83,99,111,114,101],"value":"Score"},
    33{"hash":372789,"name":"tformscore.listview1.columns[0].caption","sourcebytes":[84,105,109,101],"value":"Time"},
    4 {"hash":5875333,"name":"tformscore.listview1.columns[1].caption","sourcebytes":[83,99,111,114,101],"value":"Score"},
    5 {"hash":5532867,"name":"tformscore.listview1.columns[2].caption","sourcebytes":[77,111,118,101,115],"value":"Moves"},
    6 {"hash":6048611,"name":"tformscore.listview1.columns[3].caption","sourcebytes":[85,110,100,111,115],"value":"Undos"},
    7 {"hash":140711557,"name":"tformscore.listview1.columns[4].caption","sourcebytes":[66,111,97,114,100,32,115,105,122,101],"value":"Board size"},
     4{"hash":140711557,"name":"tformscore.listview1.columns[1].caption","sourcebytes":[66,111,97,114,100,32,115,105,122,101],"value":"Board size"},
     5{"hash":5875333,"name":"tformscore.listview1.columns[2].caption","sourcebytes":[83,99,111,114,101],"value":"Score"},
     6{"hash":250115045,"name":"tformscore.listview1.columns[3].caption","sourcebytes":[66,105,103,103,101,115,116,32,116,105,108,101],"value":"Biggest tile"},
     7{"hash":5532867,"name":"tformscore.listview1.columns[4].caption","sourcebytes":[77,111,118,101,115],"value":"Moves"},
     8{"hash":6048611,"name":"tformscore.listview1.columns[5].caption","sourcebytes":[85,110,100,111,115],"value":"Undos"},
     9{"hash":116225219,"name":"tformscore.listview1.columns[6].caption","sourcebytes":[68,105,115,97,98,108,101,100,32,116,105,108,101,115],"value":"Disabled tiles"},
     10{"hash":268299811,"name":"tformscore.listview1.columns[7].caption","sourcebytes":[85,110,109,101,114,103,101,97,98,108,101,32,116,105,108,101,115],"value":"Unmergeable tiles"},
     11{"hash":210283758,"name":"tformscore.listview1.columns[8].caption","sourcebytes":[68,117,114,97,116,105,111,110],"value":"Duration"},
    812{"hash":4863637,"name":"tformscore.buttonclose.caption","sourcebytes":[67,108,111,115,101],"value":"Close"},
    913{"hash":4860802,"name":"tformscore.buttonclear.caption","sourcebytes":[67,108,101,97,114],"value":"Clear"}
  • trunk/Forms/FormScore.pas

    r108 r109  
    4343  with FScores[Item.Index] do begin
    4444    Item.Caption := DateTimeToStr(StartTime);
     45    Item.SubItems.Add(BoardSize);
    4546    Item.SubItems.Add(IntToStr(Score));
     47    Item.SubItems.Add(IntToStr(1 shl BiggestTile));
    4648    Item.SubItems.Add(IntToStr(Moves));
    4749    Item.SubItems.Add(IntToStr(UsedUndos));
    48     Item.SubItems.Add(BoardSize);
     50    Item.SubItems.Add(IntToStr(DisabledTiles));
     51    Item.SubItems.Add(IntToStr(UnmergeableTiles));
     52    Item.SubItems.Add(TimeToStr(Duration));
    4953  end;
    5054end;
  • trunk/Languages/Game2048.cs.po

    r108 r109  
    323323#: tformscore.listview1.columns[1].caption
    324324msgctxt "tformscore.listview1.columns[1].caption"
     325msgid "Board size"
     326msgstr "Velikost desky"
     327
     328#: tformscore.listview1.columns[2].caption
     329msgctxt "tformscore.listview1.columns[2].caption"
    325330msgid "Score"
    326331msgstr "Skóre"
    327332
    328 #: tformscore.listview1.columns[2].caption
     333#: tformscore.listview1.columns[3].caption
     334msgctxt "tformscore.listview1.columns[3].caption"
     335msgid "Biggest tile"
     336msgstr "Největší dlaždice"
     337
     338#: tformscore.listview1.columns[4].caption
     339msgctxt "tformscore.listview1.columns[4].caption"
    329340msgid "Moves"
    330 msgstr "Pohyby"
    331 
    332 #: tformscore.listview1.columns[3].caption
     341msgstr "Pohybů"
     342
     343#: tformscore.listview1.columns[5].caption
     344msgctxt "tformscore.listview1.columns[5].caption"
    333345msgid "Undos"
    334346msgstr "Vrácení"
    335347
    336 #: tformscore.listview1.columns[4].caption
    337 msgid "Board size"
    338 msgstr "Velikost desky"
     348#: tformscore.listview1.columns[6].caption
     349msgctxt "tformscore.listview1.columns[6].caption"
     350msgid "Disabled tiles"
     351msgstr "Blokované dlaždice"
     352
     353#: tformscore.listview1.columns[7].caption
     354msgctxt "tformscore.listview1.columns[7].caption"
     355msgid "Unmergeable tiles"
     356msgstr "Neslučitelné dlaždice"
     357
     358#: tformscore.listview1.columns[8].caption
     359msgctxt "tformscore.listview1.columns[8].caption"
     360msgid "Duration"
     361msgstr "Trvání"
    339362
    340363#: tformsettings.buttoncancel.caption
  • trunk/Score.pas

    r108 r109  
    1717    UsedUndos: Integer;
    1818    BoardSize: string;
     19    DisabledTiles: Integer;
     20    UnmergeableTiles: Integer;
     21    BiggestTile: Integer;
    1922    procedure SaveToRegistry(Reg: TRegistryEx; RegContext: TRegistryContext);
    2023    procedure LoadFromRegistry(Reg: TRegistryEx; RegContext: TRegistryContext);
     
    3033  end;
    3134
     35
    3236implementation
    3337
     
    3943    CurrentContext := RegContext;
    4044    WriteDateTime('StartTime', StartTime);
     45    WriteDateTime('Duration', Duration);
    4146    WriteInteger('Score', Score);
    4247    WriteInteger('Moves', Moves);
    4348    WriteInteger('UsedUndos', UsedUndos);
    4449    WriteString('BoardSize', BoardSize);
     50    WriteInteger('DisabledTiles', DisabledTiles);
     51    WriteInteger('UnmergeableTiles', UnmergeableTiles);
     52    WriteInteger('BiggestTile', BiggestTile);
    4553  end;
    4654end;
     
    5260    CurrentContext := RegContext;
    5361    StartTime := ReadDateTimeWithDefault('StartTime', StartTime);
     62    Duration := ReadDateTimeWithDefault('Duration', Duration);
    5463    Score := ReadIntegerWithDefault('Score', Score);
    5564    Moves := ReadIntegerWithDefault('Moves', Moves);
    5665    UsedUndos := ReadIntegerWithDefault('UsedUndos', UsedUndos);
    5766    BoardSize := ReadStringWithDefault('BoardSize', BoardSize);
     67    DisabledTiles := ReadIntegerWithDefault('DisabledTiles', DisabledTiles);
     68    UnmergeableTiles := ReadIntegerWithDefault('UnmergeableTiles', UnmergeableTiles);
     69    BiggestTile := ReadIntegerWithDefault('BiggestTile', BiggestTile);
    5870  end;
    5971end;
Note: See TracChangeset for help on using the changeset viewer.