Skip to content

Commit

Permalink
Remove some the old children library as well as old time code, replac…
Browse files Browse the repository at this point in the history
…e #ifndefs with #pragma once to avoid collisions on Macs, spinlocks aren't needed in single threaded mode
  • Loading branch information
tewalds committed Nov 23, 2011
1 parent c0972d8 commit 4f30f52
Show file tree
Hide file tree
Showing 23 changed files with 33 additions and 189 deletions.
5 changes: 1 addition & 4 deletions assert2.h
@@ -1,6 +1,5 @@

#ifndef _ASSERT2_H_
#define _ASSERT2_H_
#pragma once

#include <cassert>
#include "string.h"
Expand All @@ -10,5 +9,3 @@
? __ASSERT_VOID_CAST (0) \
: __assert_fail ((string(__STRING(expr)) + "; " + (str)).c_str(), __FILE__, __LINE__, __ASSERT_FUNCTION))

#endif

5 changes: 1 addition & 4 deletions board.h
@@ -1,6 +1,5 @@

#ifndef _BOARD_H_
#define _BOARD_H_
#pragma once

#include <cstdio>
#include <algorithm>
Expand Down Expand Up @@ -875,5 +874,3 @@ mutable uint8_t ringdepth; //when doing a ring search, what depth was this posit
}
};

#endif

83 changes: 0 additions & 83 deletions children.h

This file was deleted.

7 changes: 1 addition & 6 deletions compacttree.h
@@ -1,8 +1,5 @@



#ifndef _COMPACTTREE_H_
#define _COMPACTTREE_H_
#pragma once

#include <new>
#include <cstring> //for memmove
Expand Down Expand Up @@ -499,5 +496,3 @@ template <class Node> class CompactTree {
}
};

#endif

5 changes: 1 addition & 4 deletions depthstats.h
@@ -1,6 +1,5 @@

#ifndef _DEPTHSTATS_H_
#define _DEPTHSTATS_H_
#pragma once

#include <stdint.h>
#include <cmath>
Expand Down Expand Up @@ -59,5 +58,3 @@ struct DepthStats {
}
};

#endif

5 changes: 1 addition & 4 deletions game.h
@@ -1,6 +1,5 @@

#ifndef _GAME_H_
#define _GAME_H_
#pragma once

#include "board.h"
#include "move.h"
Expand Down Expand Up @@ -77,5 +76,3 @@ class HavannahGame {
}
};

#endif

15 changes: 6 additions & 9 deletions gtp.h
@@ -1,6 +1,5 @@

#ifndef _GTP_H_
#define _GTP_H_
#pragma once

#include "string.h"

Expand All @@ -26,7 +25,7 @@ struct GTPResponse {
response = r;
rtrim(response);
}

GTPResponse(string r){
GTPResponse(true, r);
}
Expand Down Expand Up @@ -102,11 +101,11 @@ class GTPclient {
if(longest_cmd < name.length())
longest_cmd = name.length();
}

void newcallback(const GTPCallback & a){
callbacks.push_back(a);
}

int find_callback(const string & name){
for(unsigned int i = 0; i < callbacks.size(); i++)
if(callbacks[i].name == name)
Expand Down Expand Up @@ -155,7 +154,7 @@ class GTPclient {
string line(buf);

trim(line);

if(line.length() == 0 || line[0] == '#')
continue;

Expand Down Expand Up @@ -211,7 +210,7 @@ class GTPclient {
running = false;
return true;
}

GTPResponse gtp_list_commands(vecstr args, bool showdesc){
string ret = "\n";
for(unsigned int i = 0; i < callbacks.size(); i++){
Expand All @@ -226,5 +225,3 @@ class GTPclient {
}
};

#endif

7 changes: 2 additions & 5 deletions hashset.h
@@ -1,6 +1,5 @@

#ifndef _HASHSET_H_
#define _HASHSET_H_
#pragma once

#include "zobrist.h"

Expand Down Expand Up @@ -32,7 +31,7 @@ class HashSet {
i = (i+1) & mask;
table[i] = h;
}

bool exists(hash_t h){
for(unsigned int i = h & mask; table[i]; i = (i+1) & mask)
if(table[i] == h)
Expand All @@ -53,5 +52,3 @@ class HashSet {
}
};

#endif

5 changes: 1 addition & 4 deletions havannahgtp.h
@@ -1,6 +1,5 @@

#ifndef _HAVANNAHGTP_H_
#define _HAVANNAHGTP_H_
#pragma once

#include "gtp.h"
#include "game.h"
Expand Down Expand Up @@ -223,5 +222,3 @@ class HavannahGTP : public GTPclient {
GTPResponse gtp_solve_pnstt_clear(vecstr args);
};

#endif

5 changes: 1 addition & 4 deletions lbdist.h
@@ -1,4 +1,5 @@

#pragma once

/*
Compute a rough lower bound on the number of additional moves needed to win given this position
Expand All @@ -9,8 +10,6 @@ Increase distance when crossing an opponent virtual connection?
Decrease distance when crossing your own virtual connection?
*/

#ifndef _LBDIST_H_
#define _LBDIST_H_

#include "board.h"
#include "move.h"
Expand Down Expand Up @@ -201,5 +200,3 @@ class LBDists {
}
};

#endif

5 changes: 1 addition & 4 deletions log.h
@@ -1,6 +1,5 @@

#ifndef _LOG_H_
#define _LOG_H_
#pragma once

#include <cstdio>
#include <string>
Expand All @@ -9,5 +8,3 @@ inline void logerr(std::string str){
fprintf(stderr, "%s", str.c_str());
}

#endif

5 changes: 1 addition & 4 deletions move.h
@@ -1,6 +1,5 @@

#ifndef _MOVE_H_
#define _MOVE_H_
#pragma once

#include <stdint.h>
#include <cstdlib>
Expand Down Expand Up @@ -89,5 +88,3 @@ struct PairMove {
PairMove(MoveSpecial A) : a(Move(A)), b(M_UNKNOWN) { }
};

#endif

5 changes: 1 addition & 4 deletions player.h
@@ -1,6 +1,5 @@

#ifndef __PLAYER_H_
#define __PLAYER_H_
#pragma once

#include <cmath>
#include <cassert>
Expand Down Expand Up @@ -438,5 +437,3 @@ class Player {
Node * return_move(Node * node, int toplay) const;
};

#endif

5 changes: 1 addition & 4 deletions solver.h
@@ -1,6 +1,5 @@

#ifndef _SOLVER_H_
#define _SOLVER_H_
#pragma once

#include <stdint.h>
#include "board.h"
Expand Down Expand Up @@ -65,5 +64,3 @@ class Solver {

};

#endif

5 changes: 1 addition & 4 deletions solverab.h
@@ -1,6 +1,5 @@

#ifndef _SOLVERAB_H_
#define _SOLVERAB_H_
#pragma once

#include <stdint.h>

Expand Down Expand Up @@ -71,5 +70,3 @@ class SolverAB : public Solver {
void tt_set(const Board & board, int val);
};

#endif

5 changes: 1 addition & 4 deletions solverpns_tt.h
@@ -1,6 +1,5 @@

#ifndef _SOLVERPNS_TT_H_
#define _SOLVERPNS_TT_H_
#pragma once

#include <stdint.h>

Expand Down Expand Up @@ -130,5 +129,3 @@ class SolverPNSTT : public Solver {
PNSNode * tt(const Board & board, Move move);
};

#endif

5 changes: 1 addition & 4 deletions string.h
@@ -1,6 +1,5 @@

#ifndef _STRING_H_
#define _STRING_H_
#pragma once

#include <vector>
#include <string>
Expand Down Expand Up @@ -31,5 +30,3 @@ void rtrim(std::string & str);
vecstr explode(const std::string & str, const std::string & sep);
std::string implode(const vecstr & vec, const std::string & sep);

#endif

13 changes: 6 additions & 7 deletions thread.h
@@ -1,8 +1,5 @@



#ifndef _MY_THREAD_H_
#define _MY_THREAD_H_
#pragma once

#include <tr1/functional>
#include <pthread.h>
Expand Down Expand Up @@ -118,8 +115,13 @@ class SpinLock {
public:
SpinLock() : taken(0) { }
void lock() { while(!trylock()) ; }
#ifdef SINGLE_THREAD
bool trylock(){ return true; }
void unlock() { };
#else
bool trylock(){ return !__sync_lock_test_and_set(&taken, 1); }
void unlock() { __sync_lock_release(&taken); }
#endif
};

//object wrapper around pthread rwlock
Expand Down Expand Up @@ -231,6 +233,3 @@ class Barrier {
}
};


#endif

0 comments on commit 4f30f52

Please sign in to comment.