text:
/* Board functions relating to move making/unmaking */

#include "board.h"
#include "bitboard.h"
#include "transposition.h"
#include <string.h>
#include <stdlib.h>

//Returns 1 for legal 0 for no - test for move input etc..

int Board::testLegality(int i) {

	//Just generate all moves and check to see if one matches
	int firstMove = numMoves;

	generateMoves();

	for(int j=firstMove; j<numMoves; j++) {
		if(i == moveStack[j]) {
			numMoves = firstMove;
			makeMove(moveStack[j]);

			if(isLegal()) {
				retractMove(moveStack[j]);
				return 1;
			}

			retractMove(moveStack[j]);
			return 0;
		}
	}

	numMoves = firstMove;
	return 0;
}

int readSquare(char *square) {
	int file = (*square - 'a');
	int rank = 0;

	if(file < 8 && file >= 0) {
		rank = 8-(*(square+1) - '0');
		if(rank < 8 && rank >=0) return rank * 8 + file;
	}

	return -1;
}

int Board::parseMove(char *move) {
	int piece = 0;
	int source = 0;
	int dest = 0;
	int capture;
	int promotion = 0;
	int file;
	int returnMove = -1;

	bitboard pieceSet = 0;
	int length = strlen(move);

	if(length < 2) return -1;

	//White space
	while(*move==' ') move++;

	switch(*move) {
                case 'K': case 'k':
			piece = KING;

			if(sideToMove == MOVE_WHITE) pieceSet = wKing;
			else pieceSet = bKing;
		break;

                case 'Q': case 'q':
			piece = QUEEN;

			if(sideToMove == MOVE_WHITE) pieceSet = wQueens;
			else pieceSet = bQueens;
		break;
                case 'R': case 'r':
			piece = ROOK;

			if(sideToMove == MOVE_WHITE) pieceSet = wRooks;
			else pieceSet = bRooks;
		break;

                case 'N': case 'n':
			piece = KNIGHT;

			if(sideToMove == MOVE_WHITE) pieceSet = wKnights;
			else pieceSet = bKnights;
		break;

		case 'a':  case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
		case 'A': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H':
			piece = PAWN;

			if(sideToMove == MOVE_WHITE) pieceSet = wPawns;
			else pieceSet = bPawns;

			file = (*move - 'a');

			if(file < 8 && file >= 0) {
				pieceSet &= Bitboard::files[file];
			}

		if(file == FILE_B && !pieceSet) {
		case 'B':
				piece = BISHOP;

				if(sideToMove == MOVE_WHITE) pieceSet = wBishops;
				else pieceSet = bBishops;
		}
		break;

		case 'O':
		case 'o':
		case '0':
			if(strncmp(move, "0-0-0", 5)==0 || strncmp(move, "o-o-o", 5)==0 || strncmp(move, "O-O-O", 5)==0) {
				if(sideToMove == MOVE_WHITE) return W_CASTLE_QUEENSIDE;
					else return B_CASTLE_QUEENSIDE;
			}

			if(strncmp(move, "0-0", 3)==0 || strncmp(move, "o-o", 3)==0 || strncmp(move, "O-O", 3)==0) {
				if(sideToMove == MOVE_WHITE) return W_CASTLE_KINGSIDE;
					else return B_CASTLE_KINGSIDE;
			}

		default:
			return -1;
		break;
	}

	if(!pieceSet) return -1;

	int countsq = 0;
	int endsq = 0;

	for(int i=0; i<length-1; i++) {
		int square = readSquare(move + i);

		if(square > -1) 	{
			if(countsq == 1) {
				pieceSet &= SQUARE(dest);
			}

			dest = square;
			countsq++;

			endsq = i;
		}

		if(countsq >= 2) break;
	}

	if(countsq == 1 && piece!=PAWN) {
		for(int i=1; i<endsq; i++) {
			int square = readSquare(move + i);

			if(square == -1) {
				char qualifier =  *(move+i);

				int file = 	qualifier - 'a';
				int file2 =	qualifier - 'A';
				int rank = 	qualifier - '1';

				if(file < 8 && file >= 0) {
					pieceSet &= Bitboard::files[file];
				} else if(file2 < 8 && file2 >= 0) {
					pieceSet &= Bitboard::files[file2];
				} else if (rank < 8 && rank >= 0) {
					pieceSet &= Bitboard::ranks[7-rank];
				}

			}
		}
	}

	if(*(move+endsq + 2) == '=') {
		char promotePiece = *(move + endsq + 3);
		switch(promotePiece) {
                	case 'Q': case 'q':
				promotion = QUEEN;
			break;

                	case 'R': case 'r':
				promotion = ROOK;
			break;

                	case 'B': case 'b':
				promotion = BISHOP;

			break;

        	        case 'N': case 'n':
				promotion = KNIGHT;
			break;
		}
	}

	int countGood = 0;
	bitboard attacker = attacksTo(dest) & pieceSet;

	while(attacker) {
		source = Bitboard::firstSet(attacker);
		attacker ^= SQUARE(source);

		if(piece == PAWN && currentState->enPassant > 0 && dest == currentState->enPassant) capture = PAWN;
			else capture = pieces[dest];

		int candidateMove = dest | source << 6 | piece << 12 | capture << 16 | promotion << 20;

		if(testLegality(candidateMove)) {
			returnMove = candidateMove;
			countGood++;
		}
	}

	if(countGood==0 && piece!=PAWN) return -1;	//No move
	if(countGood > 1) return -2; //Ambiguous

	//Normal pawn moves
	if(piece == PAWN && countGood==0) {
		while(pieceSet) {
			source = Bitboard::firstSet(pieceSet);

			if((sideToMove==MOVE_WHITE && source > dest) || (sideToMove==MOVE_BLACK && source < dest))
				if(!(occupied & Bitboard::bitsTo[source][dest])) {
					returnMove = dest | source << 6 | piece << 12 | promotion << 20;

					if(testLegality(returnMove)) {
						countGood++;
					}
			}
			pieceSet ^= SQUARE(source);
		}
	}

	if(countGood == 1) return returnMove;

	return -1;
}

void Board::makeRealMove(int i) {

	numMoves = 0;
	makeMove(i);

	//We want the changes to actually stick..

	stateStack++;

	depth = 0;
	currentState = stateStack;
}

/* Make a null move, change some states but the board doesn't change */

void Board::makeNullMove() {
	currentState->move = 0;
 	depth++;
	currentState++;

	//Some operations are pointless for the null move search
	currentState->hashKey= stateStack[depth-1].hashKey;
	currentState->castling= stateStack[depth-1].castling;
	currentState->halfMoveCount = stateStack[depth-1].halfMoveCount + 1;
	currentState->enPassant = 0;
	currentState->firstMove = numMoves;

	if(sideToMove == MOVE_BLACK) moveNumber++;

	//No more enPassant possible so remove the hash mask for it
	if(stateStack[depth-1].enPassant) {
		hashEnPassant(stateStack[depth-1].enPassant);
	}

	//Nothing moves

	//Change turn
	sideToMove=!sideToMove;
	hashChangeSide();
}

/* Make a move, update all bitboards to match, no legality testing */

void Board::makeMove(int i) {
	int promotion = (i >> 20) & 15;
	int capture = (i >> 16) & 15;
	int type = (i >> 12) & 15;
	int source = (i >> 6) & 63;
	int dest = i & 63;

	currentState->move = i;

 	depth++;
	currentState++;

	currentState->hashKey= stateStack[depth-1].hashKey;
	currentState->castling= stateStack[depth-1].castling;
	currentState->halfMoveCount = stateStack[depth-1].halfMoveCount + 1;
	currentState->enPassant = 0;
	currentState->firstMove = numMoves;

	if(sideToMove == MOVE_BLACK) moveNumber++;

	//No more enPassant possible so remove the hash mask for it
	if(stateStack[depth-1].enPassant) {
		hashEnPassant(stateStack[depth-1].enPassant);
	}

	if(capture) {
		//Capture moves
		capturePiece(type, source, dest, capture, promotion);

		//cout << "Capture" << endl;
	} else {
		//Non capture
		movePiece(type, source, dest, promotion);
	}

	//Change turn
	sideToMove=!sideToMove;
	hashChangeSide();
}

inline void Board::movePiece(int type, int source, int dest, int promote) {

	//Xor with occupied masks so that it creates a 0 where the piece was and a 1 where the piece is headed
	bitboard bitMove = SQUARE(source) | SQUARE(dest);
	bitboard bitMoveLeft90 = Bitboard::squaresLeft90[source] | Bitboard::squaresLeft90[dest];
	bitboard bitMoveLeft45 = Bitboard::squaresLeft45[source] | Bitboard::squaresLeft45[dest];
	bitboard bitMoveRight45 = Bitboard::squaresRight45[source] | Bitboard::squaresRight45[dest];

	Bitboard::setClear(occupied,  bitMove);
	Bitboard::setClear(occupiedLeft45 , bitMoveLeft45);
	Bitboard::setClear(occupiedRight45 ,  bitMoveRight45);
	Bitboard::setClear(occupiedLeft90 ,  bitMoveLeft90);

	pieces[dest] = type;
	pieces[source] = 0;

	if(sideToMove == MOVE_WHITE) {

		hashWPiece(type, source);
		//Destination hash done per piece type to deal with promotions

		switch(type) {
			case QUEEN:
				Bitboard::setClear(wQueens, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
				hashWPiece(QUEEN, dest);
			break;

			case ROOK:
				whiteRookMove(source);

				Bitboard::setClear(wRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
				hashWPiece(ROOK, dest);
			break;

			case BISHOP:
				Bitboard::setClear(wBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
				hashWPiece(BISHOP, dest);
			break;

			case KNIGHT:
				Bitboard::setClear(wKnights, bitMove);
				hashWPiece(KNIGHT, dest);
			break;

			case KING:
				Bitboard::setClear(wKing, bitMove);
				hashWPiece(KING, dest);
				wKingSquare = dest;

				///cout << squareNames[source] << " " << squareNames[dest] << endl;

				//King moving 2 squares must be castling
				if(abs(dest - source) == 2) {
					//Kingside
					if(dest == G1) {
						movePiece(ROOK, H1, F1, 0);

						//Rook move will cover the kingside castling
						if(currentState->castling & W_QUEENSIDE) {
							currentState->castling &= ~W_QUEENSIDE;
							hashCastle(W_QUEENSIDE);
						}

					//Queenside
					} else {
						movePiece(ROOK, A1, D1, 0);

						//Rook move will cover the queenside castling
						if(currentState->castling & W_KINGSIDE) {
							currentState->castling &= ~W_KINGSIDE;
							hashCastle(W_KINGSIDE);
						}
					}
				} else { //Remove castling flags for normal king move..

					if(currentState->castling & W_QUEENSIDE) {
						currentState->castling &= ~W_QUEENSIDE;
						hashCastle(W_QUEENSIDE);
					}

					if(currentState->castling & W_KINGSIDE) {
						currentState->castling &= ~W_KINGSIDE;
						hashCastle(W_KINGSIDE);
					}
				}

			break;

			case PAWN:
				currentState->halfMoveCount = 0;

				if(promote) {
					pieces[dest] = promote;
					hashWPiece(promote, dest);
					whiteMaterial += (pieceValues[promote] - PAWN_VAL);
					whitePieces++;

					Bitboard::clearSquare(wPawns, source);

					switch (promote) {
						case QUEEN:
							Bitboard::setSquare(wQueens, dest);
							Bitboard::setSquare(rookMovers, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::setSquare(wRooks, dest);
							Bitboard::setSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::setSquare(wBishops, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::setSquare(wKnights, dest);
						break;

					}
				} else {
					//Normal pawn move
					Bitboard::setClear(wPawns, bitMove);
					if((source - dest) == 16) {
						currentState->enPassant = dest + 8;
						hashEnPassant(dest + 8);

//						cout << squareNames[source] << " " << squareNames[dest] << endl;
					}

					hashWPiece(PAWN, dest);
				}

			break;
		}

		Bitboard::setClear(wPieces ,  bitMove);

	} else {												//if(move == MOVE_BLACK)

		hashBPiece(type, source);
		//Destination hash done per piece type to deal with promotions

		switch(type) {
			case QUEEN:
				Bitboard::setClear(bQueens, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
				hashBPiece(QUEEN, dest);
			break;

			case ROOK:
				blackRookMove(source);

				Bitboard::setClear(bRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
				hashBPiece(ROOK, dest);
			break;

			case BISHOP:
				Bitboard::setClear(bBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
				hashBPiece(BISHOP, dest);
			break;

			case KNIGHT:
				Bitboard::setClear(bKnights, bitMove);
				hashBPiece(KNIGHT, dest);
			break;

			case KING:

				Bitboard::setClear(bKing, bitMove);
				hashBPiece(KING, dest);
				bKingSquare = dest;

				//King moving 2 squares must be castling
				if(abs(dest - source) == 2) {
					//Kingside
					if(dest == G8) {
						movePiece(ROOK, H8, F8, 0);

						//Rook move will cover the kingside castling
						if(currentState->castling & B_QUEENSIDE) {
							currentState->castling &= ~B_QUEENSIDE;
							hashCastle(B_QUEENSIDE);
						}

					//Queenside
					} else {
						movePiece(ROOK, A8, D8, 0);

						//Rook move will cover the queenside castling
						if(currentState->castling & B_KINGSIDE) {
							currentState->castling &= ~B_KINGSIDE;
							hashCastle(B_KINGSIDE);
						}

					}
				} else {
					if(currentState->castling & B_QUEENSIDE) {
						currentState->castling &= ~B_QUEENSIDE;
						hashCastle(B_QUEENSIDE);
					}

					if(currentState->castling & B_KINGSIDE) {
						currentState->castling &= ~B_KINGSIDE;
						hashCastle(B_KINGSIDE);
					}
				}

			break;

			case PAWN:
				currentState->halfMoveCount = 0;

				if(promote) {
					pieces[dest] = promote;
					hashBPiece(promote, dest);

					blackMaterial += (pieceValues[promote] - PAWN_VAL);
					blackPieces++;

					Bitboard::clearSquare(bPawns, source);

					switch (promote) {
						case QUEEN:
							Bitboard::setSquare(bQueens, dest);
							Bitboard::setSquare(rookMovers, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::setSquare(bRooks, dest);
							Bitboard::setSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::setSquare(bBishops, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::setSquare(bKnights, dest);
						break;

					}
				} else {
					//Normal pawn move
					Bitboard::setClear(bPawns, bitMove);
					if((dest - source) == 16) {
						currentState->enPassant = dest - 8;
						hashEnPassant(dest - 8);

//						cout << squareNames[source] << " " << squareNames[dest] << endl;
					}

					hashBPiece(PAWN, dest);
				}

			break;
		}

		Bitboard::setClear(bPieces ,  bitMove);
	} 	//MOVE_BLACK

		//makeMove()
}

inline void Board::capturePiece(int type, int source, int dest, int capture, int promote) {
	//Xor with occupied masks so that it creates a 0 where the piece was and a 1 where the piece is headed
	bitboard bitMove = SQUARE(source) | SQUARE(dest);

/*	bitboard bitMoveLeft90 = Bitboard::squaresLeft90[source] | Bitboard::squaresLeft90[dest];
	bitboard bitMoveLeft45 = Bitboard::squaresLeft45[source] | Bitboard::squaresLeft45[dest];
	bitboard bitMoveRight45 = Bitboard::squaresRight45[source] | Bitboard::squaresRight45[dest];*/

	/* Only need to clear the source for occupation - as there will be a piece on the destination square already -
	   except for enpassant
	*/

	currentState->halfMoveCount = 0;

	Bitboard::clearSquare(occupied,  source);
	Bitboard::clear(occupiedLeft45, Bitboard::squaresLeft45[source]);
	Bitboard::clear(occupiedRight45 ,  Bitboard::squaresRight45[source]);
	Bitboard::clear(occupiedLeft90 ,  Bitboard::squaresLeft90[source]);

	if(sideToMove == MOVE_WHITE) {

		/* Get rid of the piece being taken from specific bitboards - the
		   reason for this order is so that the rookMovers/BishopMovers
		   can be cleared without any additional if statements */
		switch (capture) {
			case QUEEN:
				Bitboard::clearSquare(bQueens, dest);

				Bitboard::clearSquare(rookMovers, dest);
				Bitboard::clearSquare(bishopMovers, dest);
				hashBPiece(QUEEN, dest);
				blackPieces--;
			break;

			case ROOK:
				blackRookMove(dest);

				Bitboard::clearSquare(bRooks, dest);
				Bitboard::clearSquare(rookMovers, dest);
				hashBPiece(ROOK, dest);
				blackPieces--;
			break;

			case BISHOP:
				Bitboard::clearSquare(bBishops, dest);
				Bitboard::clearSquare(bishopMovers, dest);
				hashBPiece(BISHOP, dest);
				blackPieces--;
			break;

			case KNIGHT:
				Bitboard::clearSquare(bKnights, dest);
				hashBPiece(KNIGHT, dest);
				blackPieces--;
			break;

			case PAWN:
				Bitboard::clearSquare(bPawns, dest);
				//cout << (int)pieces[dest] << endl;
				if(pieces[dest])  hashBPiece(PAWN, dest);  //Check is for not enPassant
			break;

			case KING:
				//Shouldn't happen, however it may require some extra error checking at some stage..
				//cerr << "Error: King was captured" << endl;
			break;
		}

		//Set pieces on board array
		pieces[source] = 0;
		pieces[dest] = type;

		hashWPiece(type, source);

		blackMaterial -= pieceValues[capture];

		switch(type) {
			case QUEEN:
				Bitboard::setClear(wQueens, bitMove);

				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);

				hashWPiece(QUEEN, dest);
			break;

			case ROOK:
				whiteRookMove(source);

				Bitboard::setClear(wRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);

				hashWPiece(ROOK, dest);
			break;

			case BISHOP:
				Bitboard::setClear(wBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);

				hashWPiece(BISHOP, dest);
			break;

			case KNIGHT:
				Bitboard::setClear(wKnights, bitMove);
				hashWPiece(KNIGHT, dest);
			break;

			case KING:
//cout << squareNames[source] << " " << squareNames[dest] << endl;
				wKingSquare = dest;

				//Cancel castling
				if(currentState->castling & W_KINGSIDE) {
					currentState->castling &= ~W_KINGSIDE;
					hashCastle(W_KINGSIDE);
				}

				if(currentState->castling & W_QUEENSIDE) {
					currentState->castling &= ~W_QUEENSIDE;
					hashCastle(W_QUEENSIDE);
				}

				Bitboard::setClear(wKing, bitMove);
				hashWPiece(KING, dest);

			break;

			case PAWN:

				if(promote) {
					pieces[dest] = promote;
					Bitboard::clearSquare(wPawns, source);
					hashWPiece(promote, dest);

					whiteMaterial += (pieceValues[promote] - PAWN_VAL);
					whitePieces++;

					switch (promote) {
						case QUEEN:
							Bitboard::setSquare(wQueens, dest);
							Bitboard::setSquare(rookMovers, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::setSquare(wRooks, dest);
							Bitboard::setSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::setSquare(wBishops, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::setSquare(wKnights, dest);
						break;
					}
				} else {
					//Normal pawn capture
					Bitboard::setClear(wPawns, bitMove);

					//Enpassant if there's no piece on the destination square
					if(dest == stateStack[depth-1].enPassant) {
						//Put a piece on the destination pawn square
						int square = dest + 8;

						//Put a piece on the destination pawn square
						Bitboard::setSquare(occupied,  dest);
						Bitboard::set(occupiedLeft45, Bitboard::squaresLeft45[dest]);
						Bitboard::set(occupiedRight45 ,  Bitboard::squaresRight45[dest]);
						Bitboard::set(occupiedLeft90 ,  Bitboard::squaresLeft90[dest]);

						//Clear pawn off occupied boards..
						Bitboard::clearSquare(occupied,  square);
						Bitboard::clear(occupiedLeft45, Bitboard::squaresLeft45[square]);
						Bitboard::clear(occupiedRight45 ,  Bitboard::squaresRight45[square]);
						Bitboard::clear(occupiedLeft90 ,  Bitboard::squaresLeft90[square]);

						//Clear off pawn actually being taken for the correct square
						Bitboard::clearSquare(bPawns, square);
						Bitboard::clearSquare(bPieces, square);

						pieces[square] = 0;
						hashBPiece(PAWN, square);
					}

					hashWPiece(PAWN, dest);
				}

			break;
		}

		Bitboard::setClear(wPieces,  bitMove);
		//Remove the piece being taken
		Bitboard::clearSquare(bPieces, dest);

	}  else {  									//if(move == MOVE_BLACK)

		switch (capture) {
			case QUEEN:
				Bitboard::clearSquare(wQueens, dest);

				Bitboard::clearSquare(rookMovers, dest);
				Bitboard::clearSquare(bishopMovers, dest);
				hashWPiece(QUEEN, dest);
				whitePieces--;
			break;

			case ROOK:
				whiteRookMove(dest);

				Bitboard::clearSquare(wRooks, dest);
				Bitboard::clearSquare(rookMovers, dest);
				hashWPiece(ROOK, dest);
				whitePieces--;
			break;

			case BISHOP:
				Bitboard::clearSquare(wBishops, dest);
				Bitboard::clearSquare(bishopMovers, dest);
				hashWPiece(BISHOP, dest);
				whitePieces--;
			break;

			case KNIGHT:
				Bitboard::clearSquare(wKnights, dest);
				hashWPiece(KNIGHT, dest);
				whitePieces--;
			break;

			case PAWN:
				Bitboard::clearSquare(wPawns, dest);
				//cout << (int)pieces[dest] << endl;
				if(pieces[dest])  hashWPiece(PAWN, dest);  //Check is for not enPassant
			break;

			case KING:
				//Shouldn't happen, however it may require some extra error checking at some stage..
				//cerr << "Error: King was captured" << endl;
			break;
		}

		//Set pieces on board array
		pieces[source] = 0;
		pieces[dest] = type;

		hashBPiece(type, source);

		whiteMaterial -= pieceValues[capture];

		switch(type) {
			case QUEEN:
				Bitboard::setClear(bQueens, bitMove);

				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);

				hashBPiece(QUEEN, dest);
			break;

			case ROOK:
				blackRookMove(source);

				Bitboard::setClear(bRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);

				hashBPiece(ROOK, dest);
			break;

			case BISHOP:
				Bitboard::setClear(bBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);

				hashBPiece(BISHOP, dest);
			break;

			case KNIGHT:
				Bitboard::setClear(bKnights, bitMove);
				hashBPiece(KNIGHT, dest);
			break;

			case KING:
				bKingSquare = dest;

				//Cancel castling
				if(currentState->castling & B_KINGSIDE) {
					currentState->castling &= ~B_KINGSIDE;
					hashCastle(B_KINGSIDE);
				}

				if(currentState->castling & B_QUEENSIDE) {
					currentState->castling &= ~B_QUEENSIDE;
					hashCastle(B_QUEENSIDE);
				}

				Bitboard::setClear(bKing, bitMove);
				hashBPiece(KING, dest);

			break;

			case PAWN:

				if(promote) {
					pieces[dest] = promote;
					Bitboard::clearSquare(bPawns, source);
					hashBPiece(promote, dest);

					blackMaterial += (pieceValues[promote] - PAWN_VAL);
					blackPieces++;

					switch (promote) {
						case QUEEN:
							Bitboard::setSquare(bQueens, dest);
							Bitboard::setSquare(rookMovers, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::setSquare(bRooks, dest);
							Bitboard::setSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::setSquare(bBishops, dest);
							Bitboard::setSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::setSquare(bKnights, dest);
						break;
					}
				} else {
					//Normal pawn capture
					Bitboard::setClear(bPawns, bitMove);

					//Enpassant if there's no piece on the destination square
					if(dest == stateStack[depth-1].enPassant) {
						//Put a piece on the destination pawn square

						int square = dest - 8;

						//Put a piece on the destination pawn square
						Bitboard::setSquare(occupied,  dest);
						Bitboard::set(occupiedLeft45, Bitboard::squaresLeft45[dest]);
						Bitboard::set(occupiedRight45 ,  Bitboard::squaresRight45[dest]);
						Bitboard::set(occupiedLeft90 ,  Bitboard::squaresLeft90[dest]);

						//Clear pawn off occupied boards..
						Bitboard::clearSquare(occupied,  square);
						Bitboard::clear(occupiedLeft45, Bitboard::squaresLeft45[square]);
						Bitboard::clear(occupiedRight45 ,  Bitboard::squaresRight45[square]);
						Bitboard::clear(occupiedLeft90 ,  Bitboard::squaresLeft90[square]);

						//Clear off pawn actually being taken for the correct square
						Bitboard::clearSquare(wPawns, square);
						Bitboard::clearSquare(wPieces, square);

						pieces[square] = 0;
						hashWPiece(PAWN, square);
					}

					hashBPiece(PAWN, dest);
				}

			break;
		}

		Bitboard::setClear(bPieces,  bitMove);
		//Remove the piece being taken
		Bitboard::clearSquare(wPieces, dest);

	} //MOVE_BLACK

} //capturePiece()

void Board::retractRealMove() {
 	if(stateStack != history) {
		int move = stateStack[-1].move;

		depth = 1;
		stateStack--;

		retractMove(move);
		numMoves = 0;
	}
}

//Retract a null move
void Board::retractNullMove() {
	numMoves = currentState->firstMove;

	//Take last state off the stack - already initialised (should be!)
	depth--;
	currentState--;

	//Change turn back again
	sideToMove=!sideToMove;

	if(sideToMove == MOVE_BLACK) moveNumber--;

}

void Board::retractMove(int i) {
	int promotion = (i >> 20) & 15;
	int capture = (i >> 16) & 15;
	int type = (i >> 12) & 15;
	int source = (i >> 6) & 63;
	int dest = i & 63;

	numMoves = currentState->firstMove;

	//Take last state off the stack - already initialised (should be!)
	depth--;
	currentState--;

	//Change turn back again
	sideToMove=!sideToMove;

	if(sideToMove == MOVE_BLACK) moveNumber--;

	if(capture) {
		//Capture moves
		unCapturePiece(type, source, dest, capture, promotion);

	//	cout << "Capture" << endl;
	} else {
		//Non capture
		unMovePiece(type, source, dest, promotion);
	}
}

//Reverse the last move... except don't worry about the hash key as we have that on the stack
inline void Board::unMovePiece(int type, int source, int dest, int promote) {

	//Xor with occupied masks so that it creates a 0 where the piece was and a 1 where the piece is headed
	bitboard bitMove = SQUARE(source) | SQUARE(dest);
	bitboard bitMoveLeft90 = Bitboard::squaresLeft90[source] | Bitboard::squaresLeft90[dest];
	bitboard bitMoveLeft45 = Bitboard::squaresLeft45[source] | Bitboard::squaresLeft45[dest];
	bitboard bitMoveRight45 = Bitboard::squaresRight45[source] | Bitboard::squaresRight45[dest];

	//Should work just the same in reverse..

	Bitboard::setClear(occupied,  bitMove);
	Bitboard::setClear(occupiedLeft45 , bitMoveLeft45);
	Bitboard::setClear(occupiedRight45 ,  bitMoveRight45);
	Bitboard::setClear(occupiedLeft90 ,  bitMoveLeft90);

	pieces[dest] = 0;
	pieces[source] = type;

	if(sideToMove == MOVE_WHITE) {
		switch(type) {
			case QUEEN:
				Bitboard::setClear(wQueens, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
			break;

			case ROOK:
				Bitboard::setClear(wRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
			break;

			case BISHOP:
				Bitboard::setClear(wBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
			break;

			case KNIGHT:
				Bitboard::setClear(wKnights, bitMove);
			break;

			case KING:
				wKingSquare = source;

				Bitboard::setClear(wKing, bitMove);

				//King moving 2 squares must be castling
				if(abs(dest - source) == 2) {
					//Kingside
					if(dest == G1) {
						unMovePiece(ROOK, H1, F1, 0);

					//Queenside
					} else {
						unMovePiece(ROOK, A1, D1, 0);

					}
				}

			break;

			case PAWN:
				if(promote) {
//					pieces[dest] = 0;
					Bitboard::setSquare(wPawns, source);
					whiteMaterial -= (pieceValues[promote] - PAWN_VAL);
					whitePieces--;

					switch (promote) {
						case QUEEN:
							Bitboard::clearSquare(wQueens, dest);
							Bitboard::clearSquare(rookMovers, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::clearSquare(wRooks, dest);
							Bitboard::clearSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::clearSquare(wBishops, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::clearSquare(wKnights, dest);
						break;

					}
				} else {
					//Normal pawn move
					Bitboard::setClear(wPawns, bitMove);
				}

			break;
		}
		Bitboard::setClear(wPieces ,  bitMove);

	} else {									//if (MOVE_BLACK)

		switch(type) {
			case QUEEN:
				Bitboard::setClear(bQueens, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
			break;

			case ROOK:
				Bitboard::setClear(bRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);
			break;

			case BISHOP:
				Bitboard::setClear(bBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
			break;

			case KNIGHT:
				Bitboard::setClear(bKnights, bitMove);
			break;

			case KING:
				Bitboard::setClear(bKing, bitMove);

				bKingSquare = source;

				//King moving 2 squares must be castling
				if(abs(dest - source) == 2) {
					//Kingside
					if(dest == G8) {
						unMovePiece(ROOK, H8, F8, 0);
					//Queenside
					} else {
						unMovePiece(ROOK, A8, D8, 0);

					}
				}

			break;

			case PAWN:
				if(promote) {
//					pieces[dest] = 0;
					Bitboard::setSquare(bPawns, source);
					blackMaterial -= (pieceValues[promote] - PAWN_VAL);
					blackPieces--;

					switch (promote) {
						case QUEEN:
							Bitboard::clearSquare(bQueens, dest);
							Bitboard::clearSquare(rookMovers, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::clearSquare(bRooks, dest);
							Bitboard::clearSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::clearSquare(bBishops, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::clearSquare(bKnights, dest);
						break;

					}
				} else {
					//Normal pawn move
					Bitboard::setClear(bPawns, bitMove);
				}

			break;
		}
		Bitboard::setClear(bPieces ,  bitMove);
	}	//MOVE_BLACK

}	//unMovePiece()

/* Mouse slip we need a take back..
   Or at least something like that.
*/
inline void Board::unCapturePiece(int type, int source, int dest, int capture, int promote) {
	//Xor with occupied masks so that it creates a 0 where the piece was and a 1 where the piece is headed
	bitboard bitMove = SQUARE(source) | SQUARE(dest);

	/* bitboard bitMoveLeft90 = Bitboard::squaresLeft90[source] | Bitboard::squaresLeft90[dest];
	bitboard bitMoveLeft45 = Bitboard::squaresLeft45[source] | Bitboard::squaresLeft45[dest];
	bitboard bitMoveRight45 = Bitboard::squaresRight45[source] | Bitboard::squaresRight45[dest]; */

	/* Only need to clear the source for occupation - as there will be a piece on the destination square already -
	   except for enpassant
	*/

	Bitboard::setSquare(occupied,  source);
	Bitboard::set(occupiedLeft45, Bitboard::squaresLeft45[source]);
	Bitboard::set(occupiedRight45 ,  Bitboard::squaresRight45[source]);
	Bitboard::set(occupiedLeft90 ,  Bitboard::squaresLeft90[source]);

	pieces[source] = type;

	if(sideToMove == MOVE_WHITE) {
		switch(type) {
			case QUEEN:
				Bitboard::setClear(wQueens, bitMove);

				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
			break;

			case ROOK:

				Bitboard::setClear(wRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);

			break;

			case BISHOP:
				Bitboard::setClear(wBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);

			break;

			case KNIGHT:
				Bitboard::setClear(wKnights, bitMove);
			break;

			case KING:
				wKingSquare = source;
				Bitboard::setClear(wKing, bitMove);
			break;

			case PAWN:

				if(promote) {
//					pieces[dest] = 0;
					Bitboard::setSquare(wPawns, source);
					whiteMaterial -= (pieceValues[promote] - PAWN_VAL);
					whitePieces--;

					switch (promote) {
						case QUEEN:
							Bitboard::clearSquare(wQueens, dest);
							Bitboard::clearSquare(rookMovers, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::clearSquare(wRooks, dest);
							Bitboard::clearSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::clearSquare(wBishops, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::clearSquare(wKnights, dest);
						break;
					}
				} else {
					//Normal pawn capture
					Bitboard::setClear(wPawns, bitMove);

					//Enpassant if there's no piece on the destination square
					if(dest == currentState->enPassant) {

						//Take pawn off destination square occupation bitboards and array
						pieces[dest] = 0;

						Bitboard::clearSquare(occupied,  dest);
						Bitboard::clear(occupiedLeft45, Bitboard::squaresLeft45[dest]);
						Bitboard::clear(occupiedRight45 ,  Bitboard::squaresRight45[dest]);
						Bitboard::clear(occupiedLeft90 ,  Bitboard::squaresLeft90[dest]);

						dest += 8;

						//Put enPassant pawn back
						Bitboard::setSquare(occupied,  dest);
						Bitboard::set(occupiedLeft45, Bitboard::squaresLeft45[dest]);
						Bitboard::set(occupiedRight45 ,  Bitboard::squaresRight45[dest]);
						Bitboard::set(occupiedLeft90 ,  Bitboard::squaresLeft90[dest]);

					}
				}

			break; //case PAWN
		}

		Bitboard::setClear(wPieces, bitMove);

		/* Put the old piece back, set array higher up so can be overwritten for enPassant */
		Bitboard::setSquare(bPieces, dest);
		pieces[dest] = capture;
		blackMaterial += pieceValues[capture];

		switch (capture) {
			case QUEEN:
				Bitboard::setSquare(bQueens, dest);

				Bitboard::setSquare(rookMovers, dest);
				Bitboard::setSquare(bishopMovers, dest);
				blackPieces++;
			break;

			case ROOK:
				Bitboard::setSquare(bRooks, dest);
				Bitboard::setSquare(rookMovers, dest);
				blackPieces++;
			break;

			case BISHOP:
				Bitboard::setSquare(bBishops, dest);
				Bitboard::setSquare(bishopMovers, dest);
				blackPieces++;
			break;

			case KNIGHT:
				Bitboard::setSquare(bKnights, dest);
				blackPieces++;
			break;

			case PAWN:
				Bitboard::setSquare(bPawns, dest);
			break;
		}

	} else {										//if(move==MOVE_BLACK)

		switch(type) {
			case QUEEN:
				Bitboard::setClear(bQueens, bitMove);

				Bitboard::setClear(rookMovers, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);
			break;

			case ROOK:

				Bitboard::setClear(bRooks, bitMove);
				Bitboard::setClear(rookMovers, bitMove);

			break;

			case BISHOP:
				Bitboard::setClear(bBishops, bitMove);
				Bitboard::setClear(bishopMovers, bitMove);

			break;

			case KNIGHT:
				Bitboard::setClear(bKnights, bitMove);
			break;

			case KING:
				bKingSquare = source;
				Bitboard::setClear(bKing, bitMove);
			break;

			case PAWN:

				if(promote) {
//					pieces[dest] = 0;
					Bitboard::setSquare(bPawns, source);
					blackMaterial -= (pieceValues[promote] - PAWN_VAL);
					blackPieces--;

					switch (promote) {
						case QUEEN:
							Bitboard::clearSquare(bQueens, dest);
							Bitboard::clearSquare(rookMovers, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case ROOK:
							Bitboard::clearSquare(bRooks, dest);
							Bitboard::clearSquare(rookMovers, dest);
						break;

						case BISHOP:
							Bitboard::clearSquare(bBishops, dest);
							Bitboard::clearSquare(bishopMovers, dest);
						break;

						case KNIGHT:
							Bitboard::clearSquare(bKnights, dest);
						break;
					}
				} else {
					//Normal pawn capture
					Bitboard::setClear(bPawns, bitMove);

					//Enpassant if there's no piece on the destination square
					if(dest == currentState->enPassant) {

						//Take pawn off destination square occupation bitboards and array
						pieces[dest] = 0;

						Bitboard::clearSquare(occupied,  dest);
						Bitboard::clear(occupiedLeft45, Bitboard::squaresLeft45[dest]);
						Bitboard::clear(occupiedRight45 ,  Bitboard::squaresRight45[dest]);
						Bitboard::clear(occupiedLeft90 ,  Bitboard::squaresLeft90[dest]);

						dest -= 8;

						//Put enPassant pawn back
						Bitboard::setSquare(occupied,  dest);
						Bitboard::set(occupiedLeft45, Bitboard::squaresLeft45[dest]);
						Bitboard::set(occupiedRight45 ,  Bitboard::squaresRight45[dest]);
						Bitboard::set(occupiedLeft90 ,  Bitboard::squaresLeft90[dest]);

					}
				}

			break; //case PAWN
		}

		Bitboard::setClear(bPieces, bitMove);

		/* Put the old piece back, set array higher up so can be overwritten for enPassant */
		Bitboard::setSquare(wPieces, dest);
		pieces[dest] = capture;
		whiteMaterial += pieceValues[capture];

		switch (capture) {
			case QUEEN:
				Bitboard::setSquare(wQueens, dest);

				Bitboard::setSquare(rookMovers, dest);
				Bitboard::setSquare(bishopMovers, dest);
				whitePieces++;
			break;

			case ROOK:
				Bitboard::setSquare(wRooks, dest);
				Bitboard::setSquare(rookMovers, dest);
				whitePieces++;
			break;

			case BISHOP:
				Bitboard::setSquare(wBishops, dest);
				Bitboard::setSquare(bishopMovers, dest);
				whitePieces++;
			break;

			case KNIGHT:
				Bitboard::setSquare(wKnights, dest);
				whitePieces++;
			break;

			case PAWN:
				Bitboard::setSquare(wPawns, dest);
			break;
		}
	}	//MOVE_BLACK

}	//unCapturePiece()

inline void Board::whiteRookMove(int source) {
	if(source == H1 && (currentState->castling & W_KINGSIDE)) {
		currentState->castling &= ~W_KINGSIDE;
		hashCastle(W_KINGSIDE);
	}

	if(source == A1 && (currentState->castling & W_QUEENSIDE)) {
		currentState->castling &= ~W_QUEENSIDE;
		hashCastle(W_QUEENSIDE);
	}
}

inline void Board::blackRookMove(int source) {

	if(source == H8 && (currentState->castling & B_KINGSIDE)) {
		currentState->castling &= ~B_KINGSIDE;
		hashCastle(B_KINGSIDE);
	}

	if(source == A8 && (currentState->castling & B_QUEENSIDE)) {
		currentState->castling &= ~B_QUEENSIDE;
		hashCastle(B_QUEENSIDE);
	}
}

redpajama_set_name: RedPajamaGithub


text:
HomeNews in PerspectiveWould we ever know what started the Ebola outbreak in West Africa?
Would we ever know what started the Ebola outbreak in West Africa?
April 10, 2016 Abdul Rashid Thomas News in Perspective 8
Dennis Kabatto
Sierra Leone Telegraph: 10 April 2016
Chernoh Alpha M. Bah, the Sierra Leonean award-winning journalist, author, chair of the African Socialist Movement of Sierra Leone and human rights advocate, arrived in New York City late Wednesday to begin a two-month book tour in the United States of America.
Mr. Bah said the aim of the tour is to promote his latest book, title: "The Ebola Outbreak in West Africa: Corporate Gangsters, Multinationals & Rogue Politricksters".
"I am hoping to build world opinion in favor of an independent investigation into the real causes of the outbreak and how we lost thousands of families and friends," Mr. Bah said.
He said his book "challenges the western narrative that the outbreak began in a remote village in Meliandou, Guinea, through zoonotic causes."
Though international news reports pinpointed a two year old Guinean boy who died on December 6, 2013 as Ebola's Patient Zero, scientists and researchers have acknowledged that they don't exactly know how the child caught the virus.
But Mr. Bah said he strongly believes the origin of the outbreak can be "located in Sierra Leone both in terms of place and time."
He argues the western media coverage was motivated by one objective, "to cover-up the actual chain of events that caused the outbreak and to exonerate the role of international actors and the local elites from responsibility for the disaster.
Some political observers, including Pan African leader and Professor Francis Boyle, a noted scholar of bio-warfare and international law at the University of Illinois, have theorized that the Ebola virus is a bio-weapon manufactured in laboratories in Africa by western governments.
He insinuated the book's subtitle "Corporate Gangsters, Multinationals & Rogue Politricksters" captures the central focus of the book, identifying the role of international forces in alliance with local elites in creating the conditions for the outbreak, and using the disaster and wreckage to fulfill material and political objectives, nationally and internationally. (Photo: Bah)
This new book on the causes and origin of the Ebola Outbreak in West Africa, illustrates how the unchallenged narrative of western media distorted the facts of the Ebola crises.
This distortion according to the author is "a continuation of a colonial legacy of multinational corporate exploitation, political corruption and western dehumanization of the African".
A damning report released by Mrs. Lara Taylor-Pearce, Auditor General of Sierra Leone on the management of Ebola funds, implicated the Sierra Leone government and officials in the ministry of health in embezzling 30 percent of the US $19 million the Sierra Leone government spent between May – October 2014 to tackle the Ebola epidemic, London based Africa Research Institute reported. (Photo: President Koroma).
On Sunday, April 10, Mr. Bah will discuss The Impact of Ebola Epidemic in West Africa: Corporate Gangsters, Multinationals & Rogue Politricksters" on African New Dawn Radio over on WRSU, 88.7 FM at Rutgers University in New Brunswick, New Jersey. The show streams live on the web at:
www.wrsu.org
USA concerned about Sierra Leone's illegal maritime activities
This is the moment for a new kind of politics in Sierra Leone
Cho Hubbard says:
Let us continue to raise awareness about corrupt politicians and rogue corporations doing business in Sierra Leone. We must also request for an independent investigation into the causes of the outbreak. It will be foolish not to.
See my notes on social media
https://www.facebook.com/notes/cho-hubbard/ebola-outbreak-in-sierra-leone-my-thoughts/1595012384059120
Mustache Moustache says:
SENESIE JUNIOR BOIMA: Now that same-sex marriage has been allowed as a way of life in America by the Supreme Court under President Barack Obama, can you then blame Kenyans as being part of this ungodly mess? I am asking because you said:
"This shows the hidden lack of patriotism of Bah of being born in Sierra Leone and his pride of his ancestors home of Guinea."
Please, why not simply debate on the Ebola issue and stop jetting in something inimical to good conversation. Would you have said this of the Late President Tejan Kabbah, who was a Madingo originally from Guinea without being tribalistic? Let me know.
alhan deen says:
Well, Ahmed Tejan Kabba's parents, that is Mum and Dad, were Mende and Mandinka, respectively. These two people are branches of the Mande nation of West Africa.
And, just to let you know, Ahmed Tejan Kabba was born in the south-east of Sierra Leone. I know this to be a fact.
Ah! This was another Russian take on the matter.
Bio-warfare agencies approach "SIMPLE PEOPLE" with an offer to fund the regeneration or modernisation of a local hospital. Of course, whilst the locals are celebrating "SHIP CAM", the "GREEKS BEARING GOOD GIFTS" are getting on with the business of RESEARCH. Hmm?
Ever wondered why all the 5+1 nations have an antidote to EBOLA but there has never been an "OUTBREAK" in their homelands? And by the way, pharmaceutical companies are not charitable/altruistic concerns.
Again, do your research. CUI BONO? Then, FOLLOW THE MONEY!
Well done Mr Bah!
Mohamed Sannoh says:
Mr. Bah has provoked an investigation of interest that I have been working on for the past two years, in my book "LIVING IN A WRETCHEDLY RICH COUNTRY (The Ebola State of Sierra Leone) awaiting publication very soon.
I tried very hard to find out about the politics of Ebola and everything came to point at President Ernest Bai Koroma of Sierra Leone, President Lansana Konteh of Guinea and President Johnson Sirleaf of Liberia.
These three presidents, still have explanations to provide for the source of Ebola. And until they do so soon, the Mano River Union countries will never be safe and protected.
Well done Mr. Bah, you are embarking on a very important mission. My only advise to is to be very careful for your life.
SENESIE JUNIOR BOIMA says:
First of all I want to condemn the statement of Bah, that the Ebola virus actually originated from Sierra Leone instead of Guinea as scientifically proven by WHO and Medicine Sans Frontier.
This shows the hidden lack of patriotism of Bah of being born in Sierra Leone and his pride of his ancestors home of Guinea. He sprinkled his lies and hypocrisy with corporate and biological warfare, despite the evidence-based practices and scientific-pathological evidence OF THE EBOLA EPIDEMICS IN SIERRA LEONE, LIBERIA AND GUINEA.
'Please be honest to yourself. No man is an Island no man stand alone'. by the Joseph Hills of Jamaica to you Mr Bah as my last words of ADVICE
The Russians declared the EBOLA outbreak as "artificial"! Besides, EBOLA is listed as a a biological weapon of war. Hmm?
QUI BONO? WHO BENEFITS? In other words, follow the money!!!

redpajama_set_name: RedPajamaCommonCrawl


A control system is a device, or set of devices to manage, command, direct or regulate the behavior of other device(s) or system(s). Industrial control systems are used in industrial production. There are two common classes of control systems, with many variations and combinations: logic or sequential controls, and feedback or linear controls. There is also fuzzy logic, which attempts to combine some of the design simplicity of logic with the utility of linear control.


Plus tips on finding the books to read and the time to read them.
One of the best bargains available to us today? Books. Why? A good book summarizes an expert's best thinking on a subject for a fraction of the cost of a course, or a conference, or counseling.
Our problem, of course, is that precious commodity: TIME. Your life is busy—just like mine. So I'll keep it simple.
I'd like to share with you the top 5 books I read this past year, the 5 strategies to read more books—and 5 ways you can find some free books.


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>IAudioRecorder Methods</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            IrrKlang.NET

IAudioRecorder Methods

The methods of the IAudioRecorder class are listed below. For a complete list of IAudioRecorder class members, see the IAudioRecorder Members topic.

Public Instance Methods

AddSoundSourceFromRecordedAudio	 Creates a sound source for the recorded audio data, so that it can be played back. Only works after calling stopRecordingAudio().

ClearRecordedAudioDataBuffer	 Clears recorded audio data buffer, freeing memory. This method will only succeed if audio recording is currently stopped.

Equals (inherited from Object)
        Determines whether the specified Object is equal to the current Object.

GetHashCode (inherited from Object)
        Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

GetType (inherited from Object)
        Gets the Type of the current instance.

StartRecordingBufferedAudio	Overloaded.

StopRecordingAudio	 Stops recording audio.

ToString (inherited from Object)
        Returns a String that represents the current Object.

Protected Instance Methods

Finalize	 Destructor

MemberwiseClone (inherited from Object)
        Creates a shallow copy of the current Object.

See Also

        IAudioRecorder Class | IrrKlang Namespace

      <object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
        <param name="Keyword" value="IAudioRecorder class, methods">
        </param>
      </object>

          The irrKlang Sound Engine Documentation © 2003-2010 by Nikolaus Gebhardt.


text:
Kainz, Austria: "Prague is certainly a worthy venue for "Battle of the Nations"-2015"
I was very happy to hear that "Battle of the Nations"-2015 would take place in Prague. It is a very beautiful city with a lot of history and it will certainly be a worthy venue for "Battle of the Nations"-2015. I will, of course, support my National Team; but I will root for every team that will fight well. Also, I know that Czech National Team are…
Talented Mr. Kainz closed his season of the year 2014
- People of the HMB movement A talented person can do all sorts of things! This saying has been confirmed by an Austrian, Mathias Kainz, known as a commentator of the online broadcast of the HMB World Championship "Battle of the Nations"-2014. Mathias proved himself as a successful HMB fighter. A fight, where Mathias Kainz and his brother Nicolas participated, took place in a fair commune…
"Battle of the Nations"-2014 has been joined by another commentator of online broadcast of the Championship
His name is Mathias Kainz and he's responsible for German-speaking audience. Meet him! Mathias is a young journalist, mastering the profession in Vienna. According to his words, he is very excited to work with HMBIA and participate in the broadcast of the fifth HMB World Championship "Battle of the Nations." For him, a young professional, it's a chance to show what he is capable of and to get…


text:
With Nothing Left to Lose, Roseanne Barr Goes for Broke, Continuing Twitter Rants
Roseanne Barr made a single tweet in the wee hours of the morning on Tuesday, and her whole life imploded. The comedian is clearly dazed and confused in the aftermath, and is continuing with an extended Twitter rant. In some posts, she's extremely apologetic; in others, she's playing the victim. She is clearly struggling to make sense of the last 48 hours.
Barr started the life-altering debacle at about 1 a.m. on Tuesday morning when she tweeted that former President Barack Obama's advisor Valerie Jarrett looked like 'the Muslim Brotherhood and Planet of the Apes had a baby'. The comment was seen as both Islamophobic and racist, considering Jarrett is African-American.
Hollywood was swift to condemn Barr. The actress deleted the comment and apologized, but a few hours later, ABC announced they were cancelling 'Roseanne'.
The sitcom that ran from 1988 to 1997 was highly popular and considered a landmark in television with the way it realistically depicted a working-class family. The show was rebooted in 2018 with most of the entire cast returning.
Barr, a Trump supporter, announced that her character Roseanne would also be portrayed as a Trump supporter. This stirred some controversy, and ABC was slammed for being willing to air a show with conservative main characters who supported the president in a non-mocking way.
To everyone's surprise, the show's reboot was a huge success, drawing an unprecedented audience of about 25 million. ABC had announced that it renewed the show for another season... then the star's tweet brought it all to a screeching halt. Effective immediately, the entire cast and crew are out of work.
When Barr's co-stars condemned her comments, she accused them of throwing her under the bus. She also continued to tweet excuses, claiming she'd been on Ambien when making the tweet, that she didn't know Jarrett was black, and that it was 'one stupid joke in a lifetime of fighting' for civil rights.
Barr then began blaming former First Lady Michelle Obama for her show being cancelled. She retweeted a 'breaking' post that read, "According to sources ABC President Channing Dungey had a long conversation via phone with former First Lady Michelle Obama before deciding to cancel the Roseanne show. Michelle Obama was reportedly enraged and insisted an apology was inadequate……developing."
"This makes alot more sense then most things," Barr wrote in response. "Is this true?"
The Jewish actress then tweeted at one point, "I think I spent the last 24 hours watching the party of inclusion, diversity, understanding, and acceptance, lynch a Jew."
Last week Barr mocked the Obamas when news about their deal to produce streaming content for Netflix was announced. She now seems to think the Obamas were out for revenge.
"Interesting. A few days after the popular #ObmasNetflixShows was all over the place making people giggle. Not surprised and I would not doubt it being very true," she said.
Barr's ex-husband, Tom Arnold, who was also a writer and guest star on the sitcom in the 1990s, also a huge critic of President Trump and the GOP, says that Barr has made racist comments before. He also says that his ex-wife was obsessed with conservative conspiracy theories.
"This monkey thing is something that she tweeted before about black people, its a meme that she and thousands of her alt-right fans do. They love to call black people monkeys, it's not a one time joke," he told CNN. "They can do this because we have a white trash racist president. That's a fact!"
Photos: You Tube
He Viciously Beat His Grandmother - His Reasoning Is Despicable
Mother Notices Black Dots Inside Her Infant's Nose - Realizes This Caused It
East Texas Police Chief Wants Citizens Armed
On Mother's Day, FLOTUS Takes Up Family While Donald Hits The Links
Trump's Controversial Plans For Fourth Of July Revealed
Donald Trump has found some inspiration for next year's Fourth of July celebrations.
President Trump is once again calling for the U.S....
Doctor's Mistake Almost Cost Boy His Eye
Cuts and scrapes are something that come with the territory when you're caring for a young, active child. When one grandmother brought a child...
Palm Springs Agrees To Remove Trees That Separate Golf Course, Historically Black Neighborhood
Back in the 1960s, a row of trees was planted when the Tahquitz Creek Golf Course was built in Palm Springs, California. Fast forward to today,...
Tribal Leader Tells Trump: 'Leave The Office You Bought'
President Trump's habit of calling Sen. Elizabeth Warren "Pocahontas" is a "disgusting" racial slur, according to the chairman of the Cheyenne...
Obamacare Has Been Replaced With Paul Ryan's Obamacare-Lite
While most congressional Republicans have pledged to "repeal and replace" the Affordable Care Act, they cannot agree on how to do it.
House...
Coast Guard Makes Big Bust
In an astounding haul, the U.S. Coast Guard seized 12,000 pounds of cocaine valued at around $181 million when it intercepted a semi-submersible...
Latino Students Allowed To Wear 'Dump Trump' T-Shirts To School
For months, 16-year-old Angelina Alvarez of Costa Mesa, California despised this message she heard from Donald Trump: Mexicans are rapists and...
Judge Gives Great Sentence To Teen Who Refused To Pay Cab Driver
Recently, 18-year-old Victoria Bascom, took a 30-mile cab ride from Cleveland to Painesville, Ohio, and then refused to pay the fare. As a result...
Man Shoots Own Penis And Lies To Cops About It
A man, with a criminal record, accidentally shot his own penis while laying in bed. He went to the hospital where police met him. They were...
Grieving Father Receives Phone Call From "Deceased" Son After Coroner Wrongly Identified Body
Frank Kerrigan of Orange County, California, was left stunned when he picked up the phone and heard his recently deceased son, 57-year-old Francis...
Michelle Obama's Comment About Republicans Sat Better With Some Than Others
Brother and Sister Both Decide to Change Genders
Donald Trump Puts A Stop To One Of President Obama's Biggest Agreements
Retired Navy Vet Refuses Award From NFL Team Over Anthem Protests
Where To Go From Here: Donald Trump's Transportation Confusion Caught On Video
If You Have One Of These Cell Phones, Get Rid Of It Immediately - You Could Be In Danger Of Radiation
Nevada About To Join 23 Other States In Passing Law Against Leaving Animal In Hot Car
Mystery Woman Saves Family Matriarch
Students Subjected To Yearbook Censorship Receive Thanks, Praise, And Surprise From Trump
Rikers Island Inmates Save Female Corrections Officer From Attempted Rape
Dementia And Diabetes Can Be Prevented By Farts According To Research
Mom From Alabama Desperately Seeking Good Samaritan That Made Her Day


text:
.. BRITS DIE IN ACCIDENT - Thai Roads Reap Two Souls
By brutox, April 22, 2017 in Thailand News
brutox 3,929
Pattaya Guru
Sadly, Thailand's notoriously deadly highways reaped two more souls .. a father and son .. it just keeps going on, and on, and on ..
Two Britons killed in Surat Thani crash
SURAT THANI: A British man and his elderly father died and the man's mother was seriously hurt when their pickup truck crashed head-on with a trailer truck on a curve in Phanom district of this southern province on Friday night.
The crash occurred at kilometre maker 16 on the Ban Takhun-Phanom Road in front of Phanom Uppatham Witthaya School in tambon Khlong Cha-oun, said Pol Capt Kanthapol Srisuksai, deputy investigation chief at the Phanom police station. The incident was reported at 8.30pm on Friday.
Police and rescue workers found three injured British nationals -- two men and a woman -- trapped inside a Chevrolet pickup truck with a Phuket licence plate on the two-lane road. They were badly hurt and rushed to Surat Thani Hospital but the two men died shortly afterward.
An overturned 18-wheel trailer truck carrying wood pellets, with a Nakhon Pathom licence plate, was found lying on its side about 10 metres away. Driver Parit Limpairoh, 23, was waiting for police at the scene, which was very dark.
A police investigation found that the 44-year-old driver and his 82-year-old father were sitting in the front seat and the driver's 78-year-old mother was sitting in the cab. They were on the way to Phuket when their vehicle lost control at the curve, causing it to crash head-on with the trailer truck travelling in the opposite direction.
Police believed the driver might have not been familiar with the route. They are continuing to investigate.
Jintana Suwannarat, director of the Surat Thani office of the Tourism Authority of Thailand, said the Thai wife of the British driver had contacted authorities to take the bodies of the two victims for religious rites at Chalerm Prakiat in Nakhon Si Thammarat.
http://www.bangkokpost.com/news/general/1236579/two-britons-killed-in-surat-thani-crash


text:
module Fog
  module Compute
    class VcloudDirector
      class Real
        # Retrieve the owner of a vApp.
        #
        # @param [String] id Object identifier of the vApp.
        # @return [Excon::Response]
        #   * body<~Hash>:
        #
        # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppOwner.html
        # @since vCloud API version 1.5
        def get_vapp_owner(id)
          request(
            :expects    => 200,
            :idempotent => true,
            :method     => 'GET',
            :parser     => Fog::ToHashDocument.new,
            :path       => "vApp/#{id}/owner"
          )
        end
      end

      class Mock
        def get_vapp_owner(id)

          type = 'application/vnd.vmware.vcloud.owner+xml'

          unless vapp = data[:vapps][id]
            raise Fog::Compute::VcloudDirector::Forbidden.new(
              'This operation is denied.'
            )
          end

          Excon::Response.new(
            :status => 200,
            :headers => {'Content-Type' => "#{type};version=#{api_version}"},
            :body => get_owner_section_body(id)
          )

        end

        def get_owner_section_body(id)
          {
            :type => 'application/vnd.vmware.vcloud.owner+xml',
            :User => {
              :type => "application/vnd.vmware.admin.user+xml",
              :name => "mockuser",
              :href => make_href("user/12345678-1234-1234-1234-12345678df2b"),
            }
          }
        end

      end

    end
  end
end


Ashley worked in China for 5 years before moving to Hong Kong in 2010. For over 10 years she worked with Chinese social media, opinion leader marketing and creative campaigns.
In 2011 Ashley established Alarice International ( www.alarice.com.hk), a marketing agency with a focus on Chinese social media. In 2013 she co-founded the Russian Business Club in Hong Kong (www.rusbc.com.hk) and in 2017, she launched ChoZan ( www.chozan.co), a membership platform for China-focused marketers.
Ashley often shares her knowledge and experience in a variety of magazines, including SCMP, China Daily, Hong Kong Economic Times, WeiPo Daily, Jumpstart Magazine, Do Marketing, Macau Business Daily and others.
Moreover, Ashley is a frequent speaker at General Assembly, WeChat Conference, Women Foundation, The Rotary Club, The Executive Group, TEDx and others.


text:
package org.springframework.web.accept;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;

import org.junit.Before;
import org.junit.Test;

import org.springframework.http.MediaType;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.ServletWebRequest;

import static org.junit.Assert.*;

/**
 * A test fixture for PathExtensionContentNegotiationStrategy.
 *
 * @author Rossen Stoyanchev
 * @since 3.2
 */
public class PathExtensionContentNegotiationStrategyTests {

	private NativeWebRequest webRequest;

	private MockHttpServletRequest servletRequest;

	@Before
	public void setup() {
		this.servletRequest = new MockHttpServletRequest();
		this.webRequest = new ServletWebRequest(servletRequest);
	}

	@Test
	public void resolveMediaTypesFromMapping() throws Exception {

		this.servletRequest.setRequestURI("test.html");

		PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy();
		List<MediaType> mediaTypes = strategy.resolveMediaTypes(this.webRequest);

		assertEquals(Arrays.asList(new MediaType("text", "html")), mediaTypes);

		Map<String, MediaType> mapping = Collections.singletonMap("HTML", MediaType.APPLICATION_XHTML_XML);
		strategy = new PathExtensionContentNegotiationStrategy(mapping);
		mediaTypes = strategy.resolveMediaTypes(this.webRequest);

		assertEquals(Arrays.asList(new MediaType("application", "xhtml+xml")), mediaTypes);
	}

	@Test
	public void resolveMediaTypesFromJaf() throws Exception {

		this.servletRequest.setRequestURI("test.xls");

		PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy();
		List<MediaType> mediaTypes = strategy.resolveMediaTypes(this.webRequest);

		assertEquals(Arrays.asList(new MediaType("application", "vnd.ms-excel")), mediaTypes);
	}

	// SPR-10334

	@Test
	public void getMediaTypeFromFilenameNoJaf() throws Exception {

		this.servletRequest.setRequestURI("test.json");

		ServletContext servletCxt = this.servletRequest.getServletContext();
		PathExtensionContentNegotiationStrategy strategy = new ServletPathExtensionContentNegotiationStrategy(servletCxt);
		strategy.setUseJaf(false);
		List<MediaType> mediaTypes = strategy.resolveMediaTypes(this.webRequest);

		assertEquals(Collections.<MediaType>emptyList(), mediaTypes);
	}

	// SPR-8678

	@Test
	public void getMediaTypeFilenameWithContextPath() throws Exception {

		PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy();

		this.servletRequest.setContextPath("/project-1.0.0.M3");
		this.servletRequest.setRequestURI("/project-1.0.0.M3/");
		assertTrue("Context path should be excluded", strategy.resolveMediaTypes(webRequest).isEmpty());

		this.servletRequest.setRequestURI("/project-1.0.0.M3");
		assertTrue("Context path should be excluded", strategy.resolveMediaTypes(webRequest).isEmpty());
	}

	// SPR-9390

	@Test
	public void getMediaTypeFilenameWithEncodedURI() throws Exception {

		this.servletRequest.setRequestURI("/quo%20vadis%3f.html");

		PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy();
		List<MediaType> result = strategy.resolveMediaTypes(webRequest);

		assertEquals("Invalid content type", Collections.singletonList(new MediaType("text", "html")), result);
	}

	// SPR-10170

	@Test
	public void resolveMediaTypesIgnoreUnknownExtension() throws Exception {

		this.servletRequest.setRequestURI("test.xyz");

		PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy();
		List<MediaType> mediaTypes = strategy.resolveMediaTypes(this.webRequest);

		assertEquals(Collections.<MediaType>emptyList(), mediaTypes);
	}

	@Test(expected = HttpMediaTypeNotAcceptableException.class)
	public void resolveMediaTypesDoNotIgnoreUnknownExtension() throws Exception {

		this.servletRequest.setRequestURI("test.xyz");

		PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy();
		strategy.setIgnoreUnknownExtensions(false);
		strategy.resolveMediaTypes(this.webRequest);
	}

}


text:
Segal TV
How do Class Action Lawsuits Work in West Virginia?
Class action lawsuits are most often used in consumer cases where a large number of people have been cheated. This could involve an illegal interest rate where their bank or credit card company was applying inappropriate fees, or it could be something much more simple where a company produces juice that they claim is 100% natural. In reality, the consumer is being cheated out of about 50 cents a bottle. These small amounts aren't worth going to court over on an individual basis, but when you look at the big picture and you're talking about thousands of people who are being cheated, this is where a class action lawsuit is best utilized. Basically, a large group of people sharing a common loss all join together in a lawsuit.
There are class action lawsuits in both state and federal courts in West Virginia. Sometimes federal cases can involve securities, stocks and bonds. It may only involve pennies on the dollar, but there again, if many people are involved, the amount people are being cheated on can result in huge losses, even in the tens of millions of dollars, and a class action lawsuit is appropriate in these cases as well.
Class Action Lawsuits Must be Approved by a Judge
Aside from juvenile cases, judges traditionally do not interfere with personal injury or wrongful death lawsuits. However, in a class action lawsuit, judges approve the attorneys that bring the lawsuit, the attorney's fees that are charged, and any settlements must also be approved by them. Their approval protects those involved in the lawsuit who might not be acquainted with the lawyer representing them and that protection assures that everything is kept public and transparent.
If you have further questions concerning class action lawsuits, you can click on the Contact Us tab at the top of the page or call 855-344-9100.
Aviation Accident Articles
Coal Mine Injury Articles
Electrical Accident Articles
Medical Malpractice Articles
Mesothelioma Articles
Nursing Home Abuse Articles
Personal Injury Articles
Articles by Scott Segal
Trucking Accident Articles
West Virginia Courts and Laws
Workplace Injury Articles
Mesothelioma Cases
Toxic Chemical Exposure
Our West Virginia personal injury attorneys and staff are dedicated exclusively to representing persons injured by the negligence or misconduct of others.
Segal Law Firm
810 Kanawha Blvd E
© 2019 Segal Law / Privacy Policy
DISCLAIMER: The general information on this website is not intended to create an attorney-client relationship. An attorney-client relationship between The Segal Law Firm and an individual is created when, after interviewing one another and evaluation, a written contract is entered into by the parties. Accessing and viewing this website and its content and general information does not create an attorney-client relationship.


text:
CHITGAR BRIDGE MASTERPLAN
Location: Tehran, Iran
Program: Infrastructure, Entertainment, Hospitality, Retail, Culture
Area: 63,000m2 GFA
Client: Municipality of Tehran
Status: Competition, 2018
Located in west Tehran, District 22, defined as a dominantly recreational area in the Tehran masterplan, has been the ground for the most recent large-scale developments in the city. The district contains two of the foremost natural features and recreational destinations of metropolitan Tehran, Chitgar Forest Park and the Persian Gulf Lake.
While both the Chitgar forest park and the Persian Gulf lake currently serve individually as major recreational destinations, lack of a coherent and strong connection between the two, has deprived them from playing a complementary role and taking advantage of their co-existence. As such, this project intends to redefine the functional and physical link between the south bank of the lake and the northern edge of the forest park.
In brief, the proposal consists of two inter-connected parts; a) the Connector and b) the masterplan in the form of a commercial-recreational campus.
The main connecting element, symbolically formed as an iconic ring, is a panoramic platform that serves as both a functional bridge between the lake and the forest, as well as a public destination for sports, events, exhibitions, outdoor performances, restaurants and activities for children. Moreover, it is a 360° promenade with open views to the lake, the mountains, the forest, and the city of Tehran.
The ring is 16m wide in two merging levels; the lower one which bridges between the forest and the elevated lake bank (7m height difference) is where the main program activities are located, and the upper one which provides an opportunity for open panoramic views, functions as a multi-purpose event space.
Tied strongly to the ring via two pedestrian axes and a gridded public park, the masterplan proposes a commercial-recreational campus which forms the southern edge of the lake and the highway. As such, the plan intends to provide private investment opportunities in sectors aligned with the aspirations of the Tehran Masterplan, namely entertainment, culture, recreation and creative industry. While the Ring is considered as a primary destination on the western edge of the plan, the eastern end consists of an entertainment anchor (a Cineplex). The ring and the Cineplex therefore, form two attractive poles on the two-opposite ends of the masterplan, serving an audience at the metropolitan scale.
Network of Research & Architecture | office@nora.global | instagram | linkedin


text:
Pornovideo è un film pornografico del 1981 diretto da Giuliana Gamba con lo pseudonimo Therese Dunn.

Il film è il primo diretto da Giuliana Gamba ed è completamente hardcore.

Trama
Il protagonista è un professionista, interpretato da Mark Shannon, innamorato di una spogliarellista hardcore, interpretata da Pauline Teutscher, i cui spettacoli erotici vengono trasmessi in TV nelle ore notturne. L'uomo sognerà di intrattenere un rapporto sessuale con la donna, ma come per magia, al suo risveglio ella si materializzerà nella realtà.

Produzione
La pellicola è tra le più ardite della produzione pornografica italiana della prima metà degli Anni ottanta, infatti essa è ricordata principalmente per le scene di una fellatio tra due omosessuali e per una pioggia dorata, ovvero la pratica sessuale in cui un uomo orina addosso al proprio partner.

Bibliografia
 Vanni Buttasi, Patrizia D'Agostino, Dizionario del cinema hard, Gremese Editore, Roma, 2000, ISBN 8877424451.

Collegamenti esterni

Film pornografici
Film diretti da Giuliana Gamba

redpajama_set_name: RedPajamaWikipedia