| | | 1 | | // -------------------------------------------------------------------------------- |
| | | 2 | | // Copyright (C) 2026 Eugene Eremeev (also known as Yevhenii Yeriemeieiv). |
| | | 3 | | // All Rights Reserved. |
| | | 4 | | // -------------------------------------------------------------------------------- |
| | | 5 | | // This software is the confidential and proprietary information of Eugene Eremeev |
| | | 6 | | // (also known as Yevhenii Yeriemeieiv) ("Confidential Information"). You shall not |
| | | 7 | | // disclose such Confidential Information and shall use it only in accordance with |
| | | 8 | | // the terms of the license agreement you entered into with Eugene Eremeev (also |
| | | 9 | | // known as Yevhenii Yeriemeieiv). |
| | | 10 | | // -------------------------------------------------------------------------------- |
| | | 11 | | |
| | | 12 | | namespace LeetCode.Algorithms.CheckIfTwoChessboardSquaresHaveTheSameColor; |
| | | 13 | | |
| | | 14 | | /// <inheritdoc /> |
| | | 15 | | public abstract class CheckIfTwoChessboardSquaresHaveTheSameColorBase : ICheckIfTwoChessboardSquaresHaveTheSameColor |
| | | 16 | | { |
| | | 17 | | public abstract bool CheckTwoChessboards(string coordinate1, string coordinate2); |
| | | 18 | | |
| | | 19 | | protected static (int X, int Y) ParseCoordinate(string coordinate) |
| | 52 | 20 | | { |
| | 52 | 21 | | var x = coordinate[0] - 'a'; |
| | 52 | 22 | | var y = coordinate[1] - '1'; |
| | | 23 | | |
| | 52 | 24 | | return (x, y); |
| | 52 | 25 | | } |
| | | 26 | | |
| | | 27 | | protected static bool GetColor(int x, int y) |
| | 90 | 28 | | { |
| | 90 | 29 | | return (x + y) % 2 == 1; |
| | 90 | 30 | | } |
| | | 31 | | } |