---
# System prepended metadata

title: Acquire Algorithms

---

# Acquire Algorithms

## Check Around Tile

**Input:** TILE in the form of "2A" or "12B"

**Output:** TBD. For now, it will output whatever is available. Anything outside the board will be "na".

**Tweaks:** Adjust the algorithm to work with how the board hash works.

```javascript=
function checkAround(tile) {

    var checkLeft = true
    var checkRight = true
    var checkDown = true
    var checkUp = true

    var left = "na"
    var right = "na"
    var up = "na"
    var down = "na"
    
    result = {}

    if (tile.length == 2) {
        num = tile.charAt(0)
        letter = tile.charAt(1)
    } else {
        num = tile.charAt(0)+tile.charAt(1)
        letter = tile.charAt(2)
    }
    if(num == "1") {
        checkLeft = false;
    } else if(num == "12") {
         checkRight = false;
    }

    if(letter == "A") {
        checkUp = false;
    } else if(letter == "I") {
        checkDown = false;
    }

    if(checkLeft) {
        var leftNum = (parseInt(num)-1).toString();
        var leftLetter = letter
        var left = board_hash[leftNum+leftLetter]
    }

    if(checkRight) {
        var rightNum = (parseInt(num)+1).toString();
        var rightLetter = letter
        var right = board_hash[rightNum+rightLetter]
    }

    if(checkUp) {
        var topNum = num
        var topLetter = String.fromCharCode(letter.charCodeAt(0)-1)
        var up = board_hash[topNum+topLetter]
    }

    if(checkDown) {
        var bottomNum = num
        var bottomLetter = String.fromCharCode(letter.charCodeAt(0)+1)
        var down = board_hash[bottomNum+bottomLetter]
    }

    return [up,down,left,right]
}
```
