battleships.rb
## CREATES GAMEBOARD AND PLACES SHIPS ON BOARD USING placeShip METHOD ##

CREATES GAMEBOARD AND PLACES SHIPS ON BOARD USING placeShip METHOD
CREATES GAMEBOARD AND PLACES SHIPS ON BOARD USING placeShip METHOD
def initialiseGameboard
	puts ""
	puts "     Welcome to BATTLESHIPS!     ".colorize(:red).colorize(:background => :white)
	initialArray = createArray
	initialArray = placeShip(5, initialArray, 1) 
	initialArray = placeShip(4, initialArray, 2)
	initialArray = placeShip(3, initialArray, 3)
	initialArray = placeShip(3, initialArray, 4)
	initialArray = placeShip(2, initialArray, 5)
	puts "\n  There are now 5 ships hidden on the board:\n\n"
	print "  1 x "
	print "SSSSS".white.on_red
	puts " (Ship #1 - Aircraft Carrier)"
	print "  1 x "
	print "SSSS".white.on_red
	puts " (Ship #2 - Cruiser)"
	print "  2 x "
	print "SSS".white.on_red
	puts " (Ship #3 & Ship #4 - Destroyers)"
	print "  1 x "
	print "SS".white.on_red
	puts " (Ship #5 - Submarine)"
	puts "\n  Just choose any co-ordinate to drop a bomb and try to hit a ship!"
	print "  The aim is to "
	print "DESTROY".colorize(:white).colorize(:background => :red)
	puts " all ships in as few moves as possible.\n"
	return initialArray
end
def initialiseGameboard puts "" puts "     Welcome to BATTLESHIPS!     " . colorize ( :red ) . colorize ( :background => :white ) initialArray = createArray initialArray = placeShip ( 5 , initialArray , 1 ) initialArray = placeShip ( 4 , initialArray , 2 ) initialArray = placeShip ( 3 , initialArray , 3 ) initialArray = placeShip ( 3 , initialArray , 4 ) initialArray = placeShip ( 2 , initialArray , 5 ) puts "\n  There are now 5 ships hidden on the board:\n\n" print "  1 x " print "SSSSS" . white . on_red puts " (Ship #1 - Aircraft Carrier)" print "  1 x " print "SSSS" . white . on_red puts " (Ship #2 - Cruiser)" print "  2 x " print "SSS" . white . on_red puts " (Ship #3 & Ship #4 - Destroyers)" print "  1 x " print "SS" . white . on_red puts " (Ship #5 - Submarine)" puts "\n  Just choose any co-ordinate to drop a bomb and try to hit a ship!" print "  The aim is to " print "DESTROY" . colorize ( :white ) . colorize ( :background => :red ) puts " all ships in as few moves as possible.\n" return initialArray end
CREATES GAMEBOARD AND PLACES SHIPS ON BOARD USING placeShip METHOD
CREATES GAMEBOARD AND PLACES SHIPS ON BOARD USING placeShip METHOD
# (length, board array, ship ID)
