From 1024cc390f5066c26c93a039c1b351762b73c378 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 8 Jan 2020 19:25:01 -0500 Subject: Added documentation and examples to aesthetics --- aesthetics.go | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) 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++ { -- cgit v1.2.3