summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aesthetics.go69
-rw-r--r--main.go88
-rw-r--r--ressources/TwoPoint.flf219
-rw-r--r--ressources/contessa411
-rw-r--r--ressources/straight.flf413
5 files changed, 1136 insertions, 64 deletions
diff --git a/aesthetics.go b/aesthetics.go
index 1881ec6..5d580f6 100644
--- a/aesthetics.go
+++ b/aesthetics.go
@@ -88,6 +88,75 @@ func (plyr player) TargetDisplay() string {
return text
}
+// printPrimary displays using ASCII art the primary battleship board
+func (plyr player) PrimarySlice() []string {
+ board := []string{
+ " ",
+ "A",
+ "B",
+ "C",
+ "D",
+ "E",
+ "F",
+ "G",
+ "H",
+ "I",
+ "J",
+ }
+ for i := 0; i < 10; i++ {
+ board = append(board, strconv.Itoa(i))
+ for j := 0; j < 10; j++ {
+ switch plyr.primary[i][j][2] {
+ case 0: // That coordinate was not hit
+ board = append(board, boatchars[1][plyr.primary[i][j][1]])
+ case 1: // That coordinates was hit
+ board = append(board, boatchars[0][plyr.primary[i][j][1]])
+ // default:
+ // return errors.New("Unknown State (hit/unhit) at a given coordinate")
+ }
+ }
+ }
+ // fmt.Println(text)
+ return board
+}
+
+func (plyr player) TargetSlice() []string {
+ board := []string{
+ " ",
+ "A",
+ "B",
+ "C",
+ "D",
+ "E",
+ "F",
+ "G",
+ "H",
+ "I",
+ "J",
+ }
+ for i := 0; i < 10; i++ {
+ board = append(board, strconv.Itoa(i))
+ for j := 0; j < 10; j++ {
+ switch plyr.target[i][j][0] {
+ case 0:
+ board = append(board, boatchars[1][0])
+ case 1:
+ if plyr.gains[plyr.prey.primary[i][j][0]] {
+ board = append(board, boatchars[0][plyr.prey.primary[i][j][1]])
+ } else {
+ switch plyr.prey.primary[i][j][0] {
+ case 0:
+ board = append(board, boatchars[0][0])
+ default:
+ board = append(board, mistery_hit)
+ }
+ }
+ }
+ }
+ }
+ return board
+}
+
// TODO: Function which returns what was hit as a commentary for the hitter
/* Boats Info:
diff --git a/main.go b/main.go
index 933b63c..c96c518 100644
--- a/main.go
+++ b/main.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ tv "github.com/rivo/tview"
)
func main() {
@@ -11,72 +12,31 @@ func main() {
ssh_game: false,
}
- if settings.debug {
-
- // SETUP:
- var player_one = player{}
- var player_two = player{}
- // Setting up prey for when using Hit function
- player_one.prey = &player_two
- player_two.prey = &player_one
-
- if settings.debug {
- fmt.Println("# #---TESTING SEQUENCE---# #")
-
- player_one.primary = [10][10][3]int{} // Empty plyr1 board
- // Initialising boats on the board work* (see initBoat TODOS)
- initBoat(&player_one, [4]int{0, 0, 0, 0}) // Index 0 -> Carrier
- initBoat(&player_one, [4]int{1, 0, 6, 9}) // Index 1 -> Battleship
- initBoat(&player_one, [4]int{2, 1, 4, 3}) // Index 2 -> Destroyer
- initBoat(&player_one, [4]int{3, 1, 7, 1}) // Index 3 -> Submarine
- initBoat(&player_one, [4]int{4, 1, 1, 8}) // Index 4 -> PatrolBoat
- // fmt.Println("Player 1:")
- // fmt.Print(player_one.PrimaryDisplay())
-
- // Initialising the board works
- // fmt.Println("Empty:")
- // fmt.Print(player_one.PrimaryDisplay())
+ // SETUP:
+ var player_one = player{}
+ var player_two = player{}
+ // Setting up prey for when using Hit function
+ player_one.prey = &player_two
+ player_two.prey = &player_one
- player_two.primary = [10][10][3]int{} // Empty plyr2 board
- initBoat(&player_two, [4]int{0, 0, 3, 3}) // Index 0 -> Carrier
- initBoat(&player_two, [4]int{1, 0, 4, 8}) // Index 1 -> Battleship
- initBoat(&player_two, [4]int{2, 1, 2, 4}) // Index 2 -> Destroyer
- initBoat(&player_two, [4]int{3, 1, 9, 0}) // Index 3 -> Submarine
- initBoat(&player_two, [4]int{4, 1, 7, 4}) // Index 4 -> PatrolBoat
-
- fmt.Println("Player 2:")
- fmt.Print(player_two.PrimaryDisplay())
-
- // fmt.Println("Hit B2:")
- // hit_coord := [2]int{1, 2} // Water hit at B2
- // fmt.Print("There was a boat: ")
- // fmt.Println(player_one.Hit(hit_coord))
- // fmt.Println(player_two.PrimaryDisplay())
- // fmt.Println("Hit H4:")
- // hit_coord = [2]int{7, 4} // PatrolBoat hit at H4
- // fmt.Print("There was a boat: ")
- // fmt.Println(player_one.Hit(hit_coord))
- // fmt.Println(player_two.PrimaryDisplay())
- // fmt.Println("Player 1 TargetDisplay:")
- // fmt.Println(player_one.TargetDisplay())
- // fmt.Println("Hit H5:")
- // hit_coord = [2]int{7, 5} // PatrolBoat hit at H4
- // fmt.Print("There was a boat: ")
- // fmt.Println(player_one.Hit(hit_coord))
- // fmt.Println(player_two.PrimaryDisplay())
- // fmt.Println("Player 1 TargetDisplay:")
- // fmt.Println(player_one.TargetDisplay())
-
- fmt.Println("Hit: E8, F8, G8")
- player_one.Hit([2]int{4, 8})
- player_one.Hit([2]int{5, 8})
- player_one.Hit([2]int{6, 8})
- fmt.Println(player_two.PrimaryDisplay())
- fmt.Println(player_one.TargetDisplay())
- player_one.Hit([2]int{6, 8})
- fmt.Println(player_two.PrimaryDisplay())
- fmt.Println(player_one.TargetDisplay())
+ if settings.debug {
+ fmt.Println(player_one.PrimarySlice())
+
+ app := tv.NewApplication()
+ flex := tv.NewFlex().
+ //AddItem(item, fixedSize, proportion, focus)
+ AddItem(tv.NewBox().SetBorder(true).SetTitle("Left (1/2 x width of Top)"), 0, 1, false).
+ AddItem(tv.NewFlex().SetDirection(tv.FlexRow).
+ AddItem(tv.NewBox().SetBorder(true).SetTitle("Top "), 0, 1, false).
+ AddItem(tv.NewBox().SetBorder(true).SetTitle("Middle (3 x height of Top)"), 0, 3, false).
+ AddItem(tv.NewBox().SetBorder(true).SetTitle("Bottom (5 rows) "), 5, 1, false), 0, 2, false).
+ AddItem(tv.NewFlex().SetDirection(tv.FlexRow).
+ AddItem(tv.NewBox().SetBorder(true).SetTitle("Gains"), 0, 1, false).
+ AddItem(tv.NewBox().SetBorder(true).SetTitle("Losses"), 0, 1, false), 12, 2, false)
+ if err := app.SetRoot(flex, true).SetFocus(flex).Run(); err != nil {
+ panic(err)
}
}
+
}
diff --git a/ressources/TwoPoint.flf b/ressources/TwoPoint.flf
new file mode 100644
index 0000000..c86d0d3
--- /dev/null
+++ b/ressources/TwoPoint.flf
@@ -0,0 +1,219 @@
+flf2a$ 2 2 8 0 14
+twopoint by Bruce Jakeway (pbjakeway@neumann.uwaterloo.ca)
+For figlet release 2.0
+Date: 1994 Aug 11
+
+Explanation of first line:
+flf2 - "magic number" for file identification
+a - should always be `a', for now
+$ - the "hardblank" -- prints as a blank, but can't be smushed
+2 - height of a character
+2 - height of a character, not including descenders
+8 - max line length (excluding comment lines)
+0 - default smushmode for this font (like "-m 15" on command line)
+14 - number of comment lines
+
+$$@
+$$@@
+|@
+o@@
+''@
+$$@@
+++@
+++@@
+(|~@
+_|)@@
+o/@
+/o@@
+ o @
+(_X@@
+)@
+$@@
+/~@
+\_@@
+~\@
+_/@@
+\|/@
+/|\@@
+$|$@
+~|~@@
+$@
+)@@
+$$@
+~~@@
+$@
+o@@
+$/@
+/$@@
+/\@
+\/@@
+'|@
+$|@@
+~)@
+/_@@
+~/@
+_)@@
+/|$@
+~|~@@
+|~@
+_)@@
+ / @
+(_)@@
+~/@
+/$@@
+(~)@
+(_)@@
+(~|@
+$/$@@
+o@
+o@@
+o@
+)@@
+/@
+\@@
+--@
+--@@
+\@
+/@@
+~)@
+o$@@
+ _ @
+(a)@@
+|~|@
+|~|@@
+|~)@
+|_)@@
+|~@
+|_@@
+|~\@
+|_/@@
+[~@
+[_@@
+|~@
+|~@@
+|~_@
+|_|@@
+|_|@
+| |@@
+|@
+|@@
+$|@
+_|@@
+|/@
+|\@@
+|$@
+|_@@
+|\/|@
+| |@@
+|\ |@
+| \|@@
+/~\@
+\_/@@
+|~)@
+|~ @@
+/~\@
+\_X@@
+|~)@
+|~\@@
+(~@
+_)@@
+~|~@
+$|$@@
+| |@
+|_|@@
+\ /@
+$\/$@@
+| |@
+$\/\/$@@
+\/@
+/\@@
+\/@
+/$@@
+~/@
+/_@@
+|~@
+|_@@
+\$@
+$\@@
+~|@
+_|@@
+/\@
+$$@@
+$$@
+__@@
+(@
+ @@
+$_$@
+(_|@@
+|_$@
+|_)@@
+$_@
+(_@@
+$_|@
+(_|@@
+$_@
+}_@@
+$|~@
+~|~@@
+(~|@
+$_|@@
+|_$@
+| |@@
+o@
+|@@
+$o@
+_|@@
+|$@
+|<@@
+|@
+|@@
+._ _$@
+| | |@@
+._$@
+| |@@
+$_$@
+(_)@@
+|)@
+|$@@
+(|@
+$|@@
+._@
+|$@@
+$_@
+_\@@
+_|_@
+$|$@@
+$ $@
+|_|@@
+$$@
+\/@@
+$ $@
+\/\/@@
+$$@
+><@@
+|_|@
+$_|@@
+_$@
+/_@@
+$|~@
+~|_@@
+|@
+|@@
+~|$@
+_|~@@
+/\/@
+$ $@@
+o~o@
+|~|@@
+o~o@
+\_/@@
+q p@
+|_|@@
+o_o@
+(_|@@
+o_o@
+(_)@@
+o o@
+|_|@@
+|~)@
+| )@@
diff --git a/ressources/contessa b/ressources/contessa
new file mode 100644
index 0000000..02916ad
--- /dev/null
+++ b/ressources/contessa
@@ -0,0 +1,411 @@
+flf2a$ 4 3 20 -1 2
+Contessa by Christopher Joseph Pirillo (pirillc2770@cobra.uni.edu)
+
+$$@
+$$@
+$$@
+$$@@
+ | @
+ | @
+ * @
+ @@
+* * @
+` ` @
+ @
+ @@
+_|_|_ @
+_|_|_ @
+ | | @
+ @@
+ _;_. @
+(_|_ @
+._|_) @
+ ` @@
+* / @
+ / @
+/ * @
+ @@
+ _;_@
+(_|_@
+(_|_@
+ ` @@
+ *@
+ '@
+ @
+ @@
+ / @
+( @
+ \ @
+ @@
+ \ @
+ )@
+ / @
+ @@
+.|, @
+-*- @
+'|` @
+ @@
+ , @
+-+- @
+ ' @
+ @@
+ @
+ @
+ * @
+ ' @@
+ @
+ ___ @
+ @
+ @@
+ @
+ @
+ * @
+ @@
+ / @
+ / @
+/ @
+ @@
+ _, @
+|.| @
+|_| @
+ @@
+ , @
+/| @
+.|. @
+ @@
+ _, @
+'_) @
+/_. @
+ @@
+ _, @
+'_) @
+._) @
+ @@
+. , @
+|_| @
+ | @
+ @@
+._, @
+|_ @
+._) @
+ @@
+._, @
+(_ @
+(_) @
+ @@
+__, @
+ / @
+/ @
+ @@
+ _, @
+(_) @
+(_) @
+ @@
+ _, @
+(_) @
+ | @
+ @@
+ @
+ * @
+ * @
+ @@
+ @
+ * @
+ * @
+ ' @@
+ / @
+< @
+ \ @
+ @@
+ @
+ === @
+ === @
+ @@
+ \ @
+ >@
+ / @
+ @@
+ _ @
+' )@
+ ; @
+ @@
+ __ @
+/(]| @
+\__/ @
+ @@
+.__.@
+[__]@
+| |@
+ @@
+.__ @
+[__)@
+[__)@
+ @@
+ __ @
+/ `@
+\__.@
+ @@
+.__ @
+| \@
+|__/@
+ @@
+.___@
+[__ @
+[___@
+ @@
+.___@
+[__ @
+| @
+ @@
+.__ @
+[ __@
+[_./@
+ @@
+. .@
+|__|@
+| |@
+ @@
+._.@
+ | @
+_|_@
+ @@
+ .@
+ |@
+\__|@
+ @@
+. .@
+|_/ @
+| \@
+ @@
+. @
+| @
+|___@
+ @@
+. .@
+|\/|@
+| |@
+ @@
+. .@
+|\ |@
+| \|@
+ @@
+.__.@
+| |@
+|__|@
+ @@
+.__ @
+[__)@
+| @
+ @@
+.__.@
+| |@
+|__\@
+ @@
+.__ @
+[__)@
+| \@
+ @@
+ __.@
+(__ @
+.__)@
+ @@
+.___.@
+ | @
+ | @
+ @@
+. .@
+| |@
+|__|@
+ @@
+. .@
+\ /@
+ \/ @
+ @@
+. .@
+| |@
+|/\|@
+ @@
+\ /@
+ >< @
+/ \@
+ @@
+. ,@
+ \./ @
+ | @
+ @@
+.___.@
+ _/ @
+./__.@
+ @@
+[~ @
+[ @
+[_ @
+ @@
+\ @
+ \ @
+ \ @
+ @@
+ ~]@
+ ]@
+ _]@
+ @@
+/\ @
+ @
+ @
+ @@
+ @
+ @
+____@
+ @@
+* @
+` @
+ @
+ @@
+ @
+ _.@
+(_]@
+ @@
+. @
+|_ @
+[_)@
+ @@
+ @
+ _.@
+(_.@
+ @@
+ .@
+ _|@
+(_]@
+ @@
+ @
+ _ @
+(/,@
+ @@
+._@
+|,@
+| @
+ @@
+ @
+ _ @
+(_]@
+._|@@
+. @
+|_ @
+[ )@
+ @@
+ @
+*@
+|@
+ @@
+ @
+ *@
+ |@
+._|@@
+. @
+;_/@
+| \@
+ @@
+.@
+|@
+|@
+ @@
+ @
+._ _ @
+[ | )@
+ @@
+ @
+._ @
+[ )@
+ @@
+ @
+ _ @
+(_)@
+ @@
+ @
+._ @
+[_)@
+| @@
+ @
+ _.@
+(_]@
+ |@@
+ @
+._.@
+[ @
+ @@
+ @
+ __@
+_) @
+ @@
+ , @
+-+-@
+ | @
+ @@
+ @
+. .@
+(_|@
+ @@
+ @
+. ,@
+ \/ @
+ @@
+ @
+. ,@
+ \/\/ @
+ @@
+ @
+\./@
+/'\@
+ @@
+ @
+ .@
+\_|@
+._|@@
+ @
+__.@
+ /_@
+ @@
+/ @
+> @
+\ @
+ @@
+| @
+| @
+| @
+ @@
+\ @
+< @
+/ @
+ @@
+/\ @
+ \/ @
+ @
+ @@
+ oo @
+|__|@
+| |@
+ @@
+ oo @
+/``\@
+\__/@
+ @@
+ oo @
+: ;@
+|__|@
+ @@
+ @
+ oo @
+(_|,@
+ @@
+ oo @
+ __ @
+(__)@
+ @@
+ oo @
+. ,@
+|__|@
+ @@
+ __ @
+| )@
+| >@
+ @@
diff --git a/ressources/straight.flf b/ressources/straight.flf
new file mode 100644
index 0000000..a0c578f
--- /dev/null
+++ b/ressources/straight.flf
@@ -0,0 +1,413 @@
+flf2a$ 4 3 10 0 4
+straight.flf Version 2
+by: Bas Meijer meijer@info.win.tue.nl bas@damek.kth.se
+fixed by: Ryan Youck youck@cs.uregina.ca
+Disclaimer: most capitals have been designed by someone else
+$$@
+$$@
+$$@
+$$@@
+ @
+| @
+. @
+ @@
+// @
+$$ @
+ @
+ @@
+ @
+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