summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2020-01-08 19:25:01 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2020-01-08 19:25:01 -0500
commit1024cc390f5066c26c93a039c1b351762b73c378 (patch)
treee5153b9331c4406d7970d60e5ab6e0be3f574948
parentb9bc54aecc6919ac8976a23a1f4ee997a6c3c6c6 (diff)
Added documentation and examples to aesthetics
-rw-r--r--aesthetics.go34
1 files changed, 33 insertions, 1 deletions
diff --git a/aesthetics.go b/aesthetics.go
index efc7cef..1881ec6 100644
--- a/aesthetics.go
+++ b/aesthetics.go
@@ -4,7 +4,22 @@ import (
"strconv"
)
-// printPrimary displays using ASCII art the primary battleship board
+// printPrimary displays an ASCII version of the primary battleship board
+// The primary board is the one which belongs to the person calling a hit
+// He sees his own boats on this board.
+// Here is an example
+// A B C D E F G H I J
+// 0 ~ ~ ~ ~ ~ ~ ~ ~ ~ △
+// 1 ~ ~ ~ ~ ~ ~ ~ ~ ~ ▯
+// 2 ~ ~ ~ ~ ~ ~ ~ ~ ~ ▽
+// 3 ~ ~ ~ ◁ ▭ ▭ ▭ ▷ ~ ~
+// 4 ~ ~ △ ~ ~ ~ ~ △ ~ ~
+// 5 ~ ~ ▯ ~ ~ ~ ~ ▯ ~ ~
+// 6 ~ ~ ▯ ~ ~ ~ ~ ~ ~ ~
+// 7 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 8 ~ ~ ~ ~ ◀ ▬ ▬ ▷ ~ ~
+// 9 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// Only E8, F8, and G8 were hit.
func (plyr player) PrimaryDisplay() string {
text := "\n A B C D E F G H I J \n"
for i := 0; i < 10; i++ {
@@ -27,6 +42,23 @@ func (plyr player) PrimaryDisplay() string {
return text
}
+// printTarget displays an ASCII version of the target battleship board
+// The target board is the one which shows a player what he knows about
+// his opponent. This is the board a player would play on.
+// Here is an example
+// A B C D E F G H I J
+// 0 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 1 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 2 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 3 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 4 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 5 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 6 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 7 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// 8 ~ ~ ~ ~ ▣ ▣ ▣ ~ ~ ~
+// 9 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+// Since the boat in F8, E8, G8 is not sunk, The player does not see
+// it's shape. Upon sinking it, he will be able to see it.
func (plyr player) TargetDisplay() string {
text := "\n A B C D E F G H I J \n"
for i := 0; i < 10; i++ {