static void PrintPlayedResultByNumber(PositionsNumberType players, OutputResultType output) { Console.WriteLine("Declaring pair: " + (players.decl1) + " - " + (players.decl2) + " (declarer is " + (output.declFlag1 ? "first" : "second") + " player)"); Console.WriteLine("Defending pair: " + (players.def1) + " - " + (players.def2) + " (opening leader is " + (output.leadFlag1 ? "first" : "second") + " player)"); PrintPlayedResultNumerical(output); }
static void PrintPassedResultByNumber(PositionsNumberType players, OutputResultType output) { Console.WriteLine("Pair 1: " + (players.decl1) + " - " + (players.decl2)); Console.WriteLine("Pair 2: " + (players.def1) + " - " + (players.def2)); Console.WriteLine("Passed out\n"); Console.WriteLine("Overall and bidding score: {0:N2} / {1:N2} ", output.overallDecl, (-output.overallDecl)); }
public static extern bool ValetGetNextScoreByNumber(ref PositionsNumberType players, ref OutputResultType output);
static void Main(string[] args) { int mode = GetMode(args); if (mode == -1) { Usage(args); } else { ControlType control = new ControlType(); control.valet = 1; // VALET_SCORING_IAF; control.leadFlag = true; control.datumHardRounding = false; int errorCode; char[] line = new char[160]; if ((errorCode = VlibImport.ValetSetControl(ref control)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } else { VlibImport.ValetClear(); VlibImport.ValetSetBoardNumber(1); if (mode == 0) { for (int i = 0; i < TEST_ENTRIES; i++) { char[] inputline = (example[i] + "\0").ToCharArray(); if ((errorCode = VlibImport.ValetAddByLine(inputline)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(example[i]); Console.WriteLine(line); } } } else if (mode == 1) { PlayersTagType players = new PlayersTagType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetTagInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByTag(ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } else { PlayersNumberType players = new PlayersNumberType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetNumberInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByNumber(ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } VlibImport.ValetCalculate(); if (mode == 0 || mode == 1) { PositionsTagType players = new PositionsTagType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByTag(ref players, ref output)) { if (!output.declFlag1 && !output.declFlag2) { PrintPassedResultByTag(players, output); } else { PrintPlayedResultByTag(players, output); } Console.WriteLine(); } } else { PositionsNumberType players = new PositionsNumberType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByNumber(ref players, ref output)) { if (players.decl1 == 0 || players.decl2 == 0 || players.def1 == 0 || players.def1 == 0) { Console.WriteLine("A player tag was not numerical"); } else { if (!output.declFlag1 && !output.declFlag2) { PrintPassedResultByNumber(players, output); } else { PrintPlayedResultByNumber(players, output); } } Console.WriteLine(); } } } } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
static void Main(string[] args) { int mode = GetMode(args); if (mode == -1) { Usage(args); } else { ControlType control = new ControlType(); control.valet = 1; // VALET_SCORING_IAF; control.leadFlag = true; control.datumHardRounding = false; int errorCode; char[] line = new char[160]; if ((errorCode = VlibImport.ValetSetControl(ref control)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } else { VlibImport.ValetClear(); VlibImport.ValetSetBoardNumber(1); if (mode == 0) { for (int i = 0; i < TEST_ENTRIES; i++) { char[] inputline = (example[i] + "\0").ToCharArray(); if ((errorCode = VlibImport.ValetAddByLine(inputline)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(example[i]); Console.WriteLine(line); } } } else if (mode == 1) { PlayersTagType players = new PlayersTagType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetTagInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByTag( ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } else { PlayersNumberType players = new PlayersNumberType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetNumberInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByNumber(ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } VlibImport.ValetCalculate(); if (mode == 0 || mode == 1) { PositionsTagType players = new PositionsTagType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByTag(ref players, ref output)) { if (!output.declFlag1 && !output.declFlag2) PrintPassedResultByTag(players, output); else PrintPlayedResultByTag(players, output); Console.WriteLine(); } } else { PositionsNumberType players = new PositionsNumberType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByNumber(ref players, ref output)) { if (players.decl1 == 0 || players.decl2 == 0 || players.def1 == 0 || players.def1 == 0) { Console.WriteLine("A player tag was not numerical"); } else { if (!output.declFlag1 && !output.declFlag2) PrintPassedResultByNumber(players, output); else PrintPlayedResultByNumber(players, output); } Console.WriteLine(); } } } } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
static void PrintPassedResultByNumber(PositionsNumberType players, OutputResultType output) { Console.WriteLine("Pair 1: " + (players.decl1) + " - " +(players.decl2) ); Console.WriteLine("Pair 2: " + (players.def1) + " - " +(players.def2)); Console.WriteLine("Passed out\n"); Console.WriteLine("Overall and bidding score: {0:N2} / {1:N2} ", output.overallDecl, (-output.overallDecl)); }