Changeset 70 for trunk/UGame.pas


Ignore:
Timestamp:
Feb 3, 2020, 1:24:08 AM (5 years ago)
Author:
chronos
Message:
  • Added: Binary numbers tile skin.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r69 r70  
    9595  end;
    9696
    97   TTileSkin = (tsLinear, tsPowerOfTwo, tsAlpha, tsRoman);
     97  TTileSkin = (tsLinear, tsPowerOfTwo, tsAlpha, tsRoman, tsBinary);
    9898
    9999  { TGame }
     
    185185  SSkinPowerOfTwo = 'Power of two';
    186186  SSkinAlpha = 'Alpha';
    187   SSkinRoman = 'Roman numerals';
     187  SSkinRoman = 'Roman';
     188  SSkinBinary = 'Binary';
    188189  STileShouldBeEmpty = 'Tile should be empty';
    189190
     
    203204  SkinText[tsAlpha] := SSkinAlpha;
    204205  SkinText[tsRoman] := SSkinRoman;
     206  SkinText[tsBinary] := SSkinBinary;
    205207end;
    206208
     
    10701072end;
    10711073
     1074function IntToBin(Num: Integer): string;
     1075begin
     1076  Result := '';
     1077  while Num > 0 do begin
     1078    Result := IntToStr(Num mod 2) + Result;
     1079    Num := Num shr 1;
     1080  end;
     1081end;
     1082
    10721083function TGame.GetTileSkinValue(Value: Integer): string;
    10731084begin
     
    10771088    tsAlpha: Result := Chr(Ord('A') + Value - 1);
    10781089    tsRoman: Result := IntToStrRoman(Value);
     1090    tsBinary: Result := IntToBin(Value);
    10791091    else Result := IntToStr(Value);
    10801092  end;
Note: See TracChangeset for help on using the changeset viewer.