[b][color=#a61c00]NOTE: This game is best played on a desktop, laptop, or tablet computer (not a phone).[br][br][/color][/b][b][color=#a61c00]This Game was Originally posted by [/color][/b][color=#a61c00][b]BHNmath, thanks this game is really fun![/b][/color][br]BHNmathBHNmathBH
Based on the classic Battleship board game, this applet allows you to practice using Cartesian coordinates while playing against a computerized opponent! The goal is to sink all of your opponent's ships before your fleet is destroyed.
[list=1][*]Your fleet is shown on the left grid. Position your ships by dragging the yellow dots. Clicking/tapping on a ship's yellow dot will change its orientation (horizontal or vertical). All ships must be entirely visible on the grid and cannot overlap each other. The [b]Randomize[/b] and [b]Reset[/b] buttons may be used to randomly position your fleet or restore the initial ship positions.[br][br][/*][*]After you've positioned your fleet, press the [b]START[/b] button and wait for the game to load (typically a few seconds). During this time, your opponent's fleet is being randomly positioned.[br][br][/*][*]Once the game has loaded, an input box will appear above the right grid. Enter the coordinates for your first shot and press the [b]Enter[/b] key (or click/tap outside of the input box). Note that the point must be entered in the form (#,#) with no spaces. Don't forget the brackets![br][br][/*][*]The right grid is used for keeping track of your shots. Your most recent shot is shown with a yellow cross and its status (hit, miss, etc.) is displayed above the right grid. Misses appear as white points and hits are displayed as red points.[br][br][/*][*]Immediately after firing your shot, your opponent (computer) will fire a shot. The results of your opponent's shots are shown on the left grid. The most recent opponent shot is shown with a yellow cross and its status (hit, miss, etc.) is displayed above the left grid.[br][br][/*][*]Continue to fire shots with the goal of sinking your opponent's entire fleet. If you sink all of your opponent's ships before all of your ships are sunk, you win![/*][/list]
Although the computerized opponent never "looks up" the position of your ships, it does use an algorithm to seek and destroy your fleet. Knowledge of this algorithm can help you determine how to best position your fleet! Here's how it works:[br][br][list=1][*]Initially, the opponent makes random shots from a list of all the open (unused) points on the grid. Each time a shot is made, that point is removed from the list.[br][br][/*][*]When a ship is hit, a list of all other possible hit points (horizontal and vertical) for that ship is created based on the ship's size and previously fired surrounding shots. The opponent now switches from [i]search mode[/i] to [i]target mode[/i] for that ship. [br][br][/*][*]The opponent begins shooting using points from the created target list, working randomly outward from the initial hit point. [br][br][/*][*]The target list is updated after each shot. Once the ship has been hit a second time, the orientation (horizontal or vertical) of the ship is known and all points from the opposite orientation are removed from the target list. Furthermore, if at any time the number of available target points in the horizontal or vertical direction is insufficient to sink the ship, points from that orientation are removed from the target list.[br][br][/*][*]If neighbouring ships are hit while a ship is being targeted, [i]target mode[/i] is also activated for those ships. When multiple ships are being targeted simultaneously, the target algorithms are executed in alphabetical order by ship name. [br][br][/*][*]When a ship is sunk, [i]target mode[/i] is deactivated for that ship. When no ships are being targeted, the opponent returns to the random [i]search mode[/i].[br][br][/*][/list][list][*]NOTE: While in [i]search mode[/i], the opponent algorithm does not consider the number of open neighbouring points. For example, if an open point is surrounded by misses/hits on all four sides, that point is not excluded from the list of available shots, even though there is no way it could be a hit. As a result, the player may have a slight advantage, especially in the final stages of a game![/*][/list][br]