int main() { float fr, tvbuf[MAXBUF*2], *fp; // Array to store Time & Voltage data from capture. int ch, ns, tg, k; fd = open_eyesj(); if(fd < 0) { fprintf(stderr,"EYES Open Failed\n"); exit(0); } set_sqr1(100.0, &fr); // Sets 100Hz on SQR1 & SQR2 , with 50% phase difference tg = 100; // Capture two channes, 8 bit resolution ns = 900; if(capture2(1, 6, ns, tg, tvbuf))err("capture2"); for(ch=0; ch < 2; ++ch) { fp = tvbuf + ch*2*ns; for(k=0; k < ns; ++k) printf("%f %f\n", fp[k], fp[ns+k]); printf("\n"); } return 0; }
TEST(MovesTest, Score) { Board board; Pieces pieces; Position position; MoveList list; Moves moves(board, pieces, position, list); Moves::init_mvv_lva_scores(); for (const PieceType& v : PIECE_TYPES) { for (const PieceType& a : PIECE_TYPES) { Square to = E5; Square from; switch (a) { case KNIGHT: from = D3; break; default: from = D4; break; } board[from] = Piece(WHITE, a); board[to] = Piece(BLACK, v); Move capture(from, to, CAPTURE); Score score = moves.mvv_lva_score(capture); EXPECT_GT(BEST_SCORE, score); EXPECT_LT(KILLERS_SCORE, score); for (const PieceType& v2 : PIECE_TYPES) { for (const PieceType& a2 : PIECE_TYPES) { switch (a2) { case KNIGHT: from = D3; break; default: from = D4; break; } board[from] = Piece(WHITE, a2); board[to] = Piece(BLACK, v2); Move capture2(from, to, CAPTURE); Score score2 = moves.mvv_lva_score(capture2); if (v > v2) { EXPECT_GT(score, score2); } else if (v < v2) { EXPECT_LT(score, score2); } else { if (a > a2) { EXPECT_LT(score, score2); } else if (a < a2) { EXPECT_GT(score, score2); } else { EXPECT_EQ(score, score2); } } } } } } }