Here you can find the source of intToAlgebraicLoc(int loc)
Parameter | Description |
---|---|
loc | an int in [0, 64) representing a location |
public static String intToAlgebraicLoc(int loc)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w .j a va2s .c o m * Converts an integer location in [0, 64) to a string in * "algebraic notation" (ie. of the form 'a7', 'c5). * * @param loc * an int in [0, 64) representing a location * @return the "algebraic notation" of the location */ public static String intToAlgebraicLoc(int loc) { if (loc == -1) return "-"; int out = loc % 8; int up = loc / 8; char outc = (char) (out + 'a'); char upc = (char) (up + '1'); return outc + "" + upc; } }