Skip to content

Commit

Permalink
fix FEN, alter readme, change some whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
penteract committed Sep 2, 2021
1 parent 39b28dd commit 85332cf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
36 changes: 18 additions & 18 deletions DataInterfaceConsoleTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ private static void RecordGames(DataInterface di)
int oldCnt = 0;
string lastRun = "";
string fen = "";
var lastP = di.GetCurrentPlayersTurn();
var lastTime = di.GetCurT();
System.Media.SoundPlayer player = new System.Media.SoundPlayer("Tick.wav");
var lastP = di.GetCurrentPlayersTurn();
var lastTime = di.GetCurT();
System.Media.SoundPlayer player = new System.Media.SoundPlayer("Tick.wav");
List<int> times = new List<int>();
int oldTurn = 0;
bool written = false;
Expand All @@ -46,28 +46,28 @@ private static void RecordGames(DataInterface di)
var localPlayer = -1;
while (true)
{
var thisP = di.GetCurrentPlayersTurn();
var thisTime = di.GetCurT();
if(thisP!=lastP){// Reset timers
lastTime=thisTime;
lastP=thisP;
}
if (lastTime!=0 && (thisTime-1)*3<=(lastTime-1)*2){//Should always tick if thisTime==1 or thisTime==0
var thisP = di.GetCurrentPlayersTurn();
var thisTime = di.GetCurT();
if(thisP!=lastP){// Reset timers
lastTime=thisTime;
lastP=thisP;
}
if (lastTime!=0 && (thisTime-1)*3<=(lastTime-1)*2){//Should always tick if thisTime==1 or thisTime==0
try{
player.Play();
}
catch {
}
lastTime=thisTime;
//System.Media.SystemSounds.Exclamation.Play();
}
// Potential reasons to beep:
// time remaining is a power of 2
// 1 minute remaining (only beep once for this?)
// half the time you started the turn with
// When you use up your increment
// when you're significantly behind your opponent
}
// Potential reasons to beep:
// time remaining is a power of 2
// 1 minute remaining (only beep once for this?)
// half the time you started the turn with
// When you use up your increment
// when you're significantly behind your opponent
var cnt = di.GetChessBoardAmount();
var turn = di.GetCurrentPlayersTurn();
//turn != oldTurn is there to make sure we record times, but we shouldn't rely
Expand Down
14 changes: 10 additions & 4 deletions FiveDChessDataInterface/Types/ChessBoard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public string toFEN(string timeline, string turn){
pieces += $"{i}";
}
else{
pieces += p.SingleLetterNotation();
pieces += p.FENSymbol();
}
}
}
Expand Down Expand Up @@ -97,9 +97,15 @@ public override string ToString()
}

// For 5D FEN
public string SingleLetterNotation()
{
var p = this.Kind==PieceKind.Pawn?"P":this.Notation();
public string FENSymbol()
{ var p = this.Kind switch {
PieceKind.Pawn => "P*",
PieceKind.King => "K*",
PieceKind.Rook => "R*",
PieceKind.Brawn => "W*",
_ => this.Notation()
};

if (this.IsBlack) return p.ToLower();
else return p;
}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ Note: The files produced contain your timezone (as an offset from UTC), so if yo
While it should be stable for the most part, this program may still cause crashes/desyncs or other unexpected/unwanted behaviour, hence why the developers of this project cannot be held liable for any damage caused.

## Plans
Config file (name, which tags to include, sound file, how and whether to present time, always use white's perspective)
Automatic variant recognition (currently detects "Standard - Turn Zero", but I'm not sure it's always accurate when it claims that)
Config file (name, which tags to include, sound file, how and whether to include time, always use white's perspective)

0 comments on commit 85332cf

Please sign in to comment.