14
Introduction
A normal checkers board contains 8 x 8 = 64 squares:
You can see that in total, there are 12 white pieces. Black and white always have the same amount of pieces. If there are any more pieces on the board, the pieces would neighbouring, which is not allowed for this challenge. To clarify things, here are some examples:
The smallest board possible for this challenge is 3 x 3:
You can see that the maximum amount of pieces is equal to 2. So, when given N = 3, you need to output 2. If the input is N = 4, we get the following:
You can see that the maximum amount is also 2. So for N = 4, the output should be 2. For N = 5, the output should be equal to 5:
Examples
STDIN: 3
STDOUT: 2
STDIN: 4
STDOUT: 2
STDIN: 5
STDOUT: 5
STDIN: 6
STDOUT: 6
STDIN: 8
STDOUT: 12
Rules
- Your submission must be a program, or function etc. that takes one integer and outputs or returns the number of pieces on the board
- You can safely assume that the input is an non-negative integer > 2
- This is code-golf, so the program with the least amount of bytes wins!
- Note that the square in the lower left of the board is always dark. Pieces are only placed on dark squares
- You have to occupy a full row with pieces
3Why the restriction to full programs and STDIN/STDOUT? IMO that's just unfair to languages that have necessary program and/or input overhead. – lirtosiast – 2015-12-02T02:58:15.383
@ThomasKwa, you're right. Functions etc. are now allowed – Adnan – 2015-12-02T08:25:58.370