Last active
February 14, 2018 16:33
-
-
Save banksean/c7c8fb592dfbfb5454810211f7004fc7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I was going to use slices, but hey I'm lazy why not let the compiler | |
// verify that I put the right number rows and columns in? | |
type literalBoard [8][8]ScoreType | |
var ( | |
LiteralBoard = literalBoard{ | |
{TW, None, None, DL, None, None, None, TW}, | |
{None, DW, None, None, None, TL, None, None}, | |
{None, None, DW, None, None, None, DL, None}, | |
{DL, None, None, DW, None, None, None, DL}, | |
{None, None, None, None, DW, None, None, None}, | |
{None, TL, None, None, None, TL, None, None}, | |
{None, None, DL, None, None, None, DL, None}, | |
{TW, None, None, DL, None, None, None, DW}, | |
} | |
) | |
// ScoreAtLiteral uses the method you were thinking of all along | |
// to return the score multiplier at x, y. | |
func ScoreAtLiteral(x, y int) ScoreType { | |
// Symmetric adjustments if x or y > 7. We could | |
// eliminate these by making LiteralBoard be 15x15 | |
// but YOLO. | |
if x > 7 { | |
x = 14 - x | |
} | |
if y > 7 { | |
y = 14 - y | |
} | |
return LiteralBoard[y][x] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment