Here you can find the source of bit(int row, int col)
Parameter | Description |
---|---|
row | row of square to set |
col | col of square to set |
public static long bit(int row, int col)
//package com.java2s; /*/*w ww . ja v a 2 s. co m*/ * Copyright (c) 2014 Chris Welty. * * This is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3, * as published by the Free Software Foundation. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * For the license, see <http://www.gnu.org/licenses/gpl.html>. */ public class Main { /** * Bitboard containing a single set bit * * @param row row of square to set * @param col col of square to set * @return bitboard */ public static long bit(int row, int col) { return 1L << square(row, col); } /** * Calc square index from row and col index * * @param row index of row * @param col index of col * @return square index */ public static int square(int row, int col) { return row * 8 + col; } }