Sha256: 4bf0f97105c0c5699999a53b5a8bc92e6253a1b3fd1652af5868dc18f83da6a6
Contents?: true
Size: 790 Bytes
Versions: 124
Compression:
Stored size: 790 Bytes
Contents
#include "queen_attack.h" #define ROW_COUNT 8 #define COLUMN_COUNT 8 attack_status_t can_attack(position_t white_queen, position_t black_queen) { if ((white_queen.column == black_queen.column && white_queen.row == black_queen.row) || white_queen.row >= ROW_COUNT || white_queen.column >= COLUMN_COUNT || black_queen.row >= ROW_COUNT || black_queen.column >= COLUMN_COUNT) { return INVALID_POSITION; } if (white_queen.column == black_queen.column || white_queen.row == black_queen.row || (white_queen.row - black_queen.row == white_queen.column - black_queen.column) || (white_queen.row - black_queen.row == black_queen.column - white_queen.column)) { return CAN_ATTACK; } return CAN_NOT_ATTACK; }
Version data entries
124 entries across 124 versions & 1 rubygems