Skip to content

Commit 1f2c8bd

Browse files
committed
Minor changes
1 parent 1bc5cda commit 1f2c8bd

File tree

4 files changed

+11
-45
lines changed

4 files changed

+11
-45
lines changed

src/endgame_database.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,12 @@ bool EndgameFunctionality::name_match(string name_pattern) {
862862
return match;
863863
}
864864

865-
865+
/**
866+
* Returns
867+
* 0 for an illegal position
868+
* 1 for an unreachable position
869+
* 2 for a legal position
870+
*/
866871
int EndgameFunctionality::legal_position(int player, int table_index) {
867872
Board2 board;
868873
vector<PiecePos> piece_list(num_pieces);

src/endgame_simple_construction.cxx

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#ifdef ALLOW_5_MEN_ENDGAME
23
if (num_pieces == 5) {
34
cerr << "################################################################\n"
@@ -37,36 +38,7 @@ for (int player=0; player<(symmetric_endgame ? 1 : 2); player++) {
3738

3839
for (uint i=0; i<table_size; i++) {
3940
(*decompress_table_index)(i, piece_list);
40-
41-
//cerr << "decompress_table_index_en_passant: " << decompress_table_index_en_passant << "\n";
42-
43-
/*
44-
#include "board_define_position_constants.hxx"
45-
bool test = (piece_list[0].pos == a1) && (piece_list[1].pos == a4) &&
46-
(piece_list[2].pos == e1) && (piece_list[3].pos == b4);
47-
#include "board_undef_position_constan int &_castling, int &_en_passant,// use 0, ILLEGAL_POS as default
48-
int _moves_played_since_progress = 0, int full_move_number = 1);ts.hxx"
49-
if (test) cerr << "Interesting position: index = " << i << "\n";
50-
*/
51-
5241
bool legal_position = board.set_board(piece_list, player);
53-
54-
/* No need to trash unreachable positions in the table.
55-
They are trashed when constructing the bdd instead.
56-
if (legal_position && board.unreachable_position() &&
57-
*(endgame_settings->trash_unreachable_positions)) {
58-
board.print_board(big_output);
59-
legal_position = false;
60-
}
61-
*/
62-
63-
/*
64-
cerr << "index = " << i << ", position = ";
65-
for (uint j=0; j<piece_list.size(); j++)
66-
cerr << POS_NAME[piece_list[j].pos] << ", ";
67-
cerr << "player = " << player << "\n";
68-
*/
69-
7042
if (legal_position) {
7143
int status;
7244
switch (status = board.calc_game_status()) {
@@ -110,15 +82,6 @@ for (int player=0; player<(symmetric_endgame ? 1 : 2); player++) {
11082
} else {
11183

11284
table[player][i] = ENDGAME_TABLE_ILLEGAL;
113-
114-
/*
115-
if (i==258376) {
116-
cerr << "Illegal position:\n(k1,p1,p2,k2,p3)=(" << POS_NAME[piece_list[0].pos] << ", "
117-
<< POS_NAME[piece_list[1].pos] << ", " << POS_NAME[piece_list[2].pos] << ", "
118-
<< POS_NAME[piece_list[3].pos] << ", " << POS_NAME[piece_list[4].pos]
119-
<< "), player = " << player << "\n";
120-
}
121-
*/
12285
}
12386
}
12487
}

src/run_length_encoding/huffman_codec.hxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
template <class TYPE>
1414
class HuffTreeNode;
1515

16-
// To do: Pak denne struct ind
1716
struct WHC {
1817
WHC() : w(0), h(0), c(0) {}
1918
WHC(int w, int h, int c) : w(w), h(h), c(c) {}
@@ -25,6 +24,7 @@ template <class TYPE, class ElementStreamer = DefaultElementStreamer<TYPE> >
2524
class Huffman {
2625
public:
2726
Huffman();
27+
~Huffman() { delete tree; }
2828

2929
void init(const vector<pair<TYPE, float> > &distribution, bool makeCanonical = false);
3030
Huffman(const vector<pair<TYPE, float> > &distribution, bool makeCanonical = false);
@@ -38,8 +38,6 @@ public:
3838
template<class INPUT_MODEL>
3939
void init(ibstream<INPUT_MODEL> &in);
4040

41-
~Huffman() { delete tree; }
42-
4341
// This description is what is being read by the constructor.
4442
template<class OUTPUT_MODEL>
4543
void outputDescription(obstream<OUTPUT_MODEL> &out);

src/run_length_encoding/run_length.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class BinaryRunLengthEncoder {
55
public:
66
BinaryRunLengthEncoder(obstream *out) : out(out), init(false) {}
7-
7+
88
void addBit(bool bit) {
99
if (!init) {
1010
init = true;
@@ -22,7 +22,7 @@ public:
2222
count = 1;
2323
}
2424
}
25-
25+
2626
void finalize() {
2727
if (init) {
2828
out->writeArbitraryNumber(count);
@@ -52,7 +52,7 @@ public:
5252
--count;
5353
return last_bit;
5454
}
55-
55+
5656
private:
5757
int count;
5858
bool last_bit;

0 commit comments

Comments
 (0)