BattleShip

所属分类:游戏机
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2018-12-10 05:01:44
上 传 者sh-1993
说明:  战舰游戏是一种由两名玩家在海上玩的战争游戏。每个玩家拥有自己的战斗区域,每个玩家将获得相同数量的shi...,
(Battleship game is a war game played on ocean by two players. Each player own his battle area and each player will get same number of ships where each ship may have different size placed at some position in non-overlapping fashion.)

文件列表:
BattleShipGame/ (0, 2018-12-09)
BattleShipGame/App.config (180, 2018-12-09)
BattleShipGame/BattleShipGame.csproj (3631, 2018-12-09)
BattleShipGame/BattleShipGame.sln (1125, 2018-12-09)
BattleShipGame/Constants/ (0, 2018-12-09)
BattleShipGame/Constants/AppConstants.cs (1344, 2018-12-09)
BattleShipGame/Extensions/ (0, 2018-12-09)
BattleShipGame/Extensions/StringExtension.cs (535, 2018-12-09)
BattleShipGame/GamePlay.cs (1265, 2018-12-09)
BattleShipGame/GamePlayArgs.cs (216, 2018-12-09)
BattleShipGame/InputValidator.cs (10298, 2018-12-09)
BattleShipGame/InputValidatorArgs.cs (310, 2018-12-09)
BattleShipGame/InteractiveConsole/ (0, 2018-12-09)
BattleShipGame/InteractiveConsole/ContinueCommand.cs (193, 2018-12-09)
BattleShipGame/InteractiveConsole/ExitCommand.cs (188, 2018-12-09)
BattleShipGame/InteractiveConsole/ICommand.cs (122, 2018-12-09)
BattleShipGame/InteractiveConsole/Interpreter.cs (5958, 2018-12-09)
BattleShipGame/Interfaces/ (0, 2018-12-09)
BattleShipGame/Interfaces/IBattleshipBoardService.cs (254, 2018-12-09)
BattleShipGame/Interfaces/IGamePlatArgs.cs (170, 2018-12-09)
BattleShipGame/Interfaces/IGamePlay.cs (102, 2018-12-09)
BattleShipGame/Interfaces/IGamePlayBoardService.cs (429, 2018-12-09)
BattleShipGame/Interfaces/IInputValidator.cs (179, 2018-12-09)
BattleShipGame/Interfaces/IInputValidatorArgs.cs (246, 2018-12-09)
BattleShipGame/Models/ (0, 2018-12-09)
BattleShipGame/Models/Battleship.cs (556, 2018-12-09)
BattleShipGame/Models/BattleshipBoard.cs (421, 2018-12-09)
BattleShipGame/Models/BattleshipType.cs (253, 2018-12-09)
BattleShipGame/Models/GamePlayBoard.cs (1865, 2018-12-09)
BattleShipGame/Models/Player.cs (291, 2018-12-09)
BattleShipGame/Program.cs (2353, 2018-12-09)
BattleShipGame/Properties/ (0, 2018-12-09)
BattleShipGame/Properties/AssemblyInfo.cs (1392, 2018-12-09)
BattleShipGame/Services/ (0, 2018-12-09)
BattleShipGame/Services/BattleshipBoardService.cs (1349, 2018-12-09)
BattleShipGame/Services/GamePlayBoardService.cs (6851, 2018-12-09)
BattleShip_Game_V3.pdf (92013, 2018-12-09)
LICENSE (35149, 2018-12-09)
... ...

# BattleShip BattleShip is a turn-based two-player game that simulates a war between ships on an ocean. Each player gets their own battle area with a certain number of ships placed in non-overlapping positions. The ships might be of different sizes. Note, players cannot see each others ship's location. There are two types of ships - type P and type Q. Type P ships can be destroyed by a single hit in each of their cells and type Q ships require 2 hits in each of their cells. A ship is considered destroyed when all of its cells are destroyed. The player who destroys all the ships of the other player first wins the game. The game ends in a draw if none of the players can destroy all of the other’s ships using a finite number of missiles. Constraints: - 1 <= Width of Battle area (M’) <= 9, - A <= Height of Battle area (N’) <= Z - 1 <= Number of battleships <= M’ * N’ - Type of ship = {‘P’, ‘Q’} - 1 <= Width of battleship <= M’ - A <= Height of battleship <= N’ - 1 <= X coordinate of ship <= M’ - A <= Y coordinate of ship <= N’ Input: - The first line of the input contains the width and height of the battle area respectively. - The second line of the input contains the number of battleships that each player gets. - The third line of the input contains the type of the battleship, its dimensions (width and height) and coordinates for Player-1 and Player-2. - The fourth line of the input contains the type of the battleship, its dimensions (width and height) and coordinates for Player-1 and Player-2. - The fifth line contains the sequence of the target locations of missiles fired by Player-1. - The sixth line contains the sequence of the target locations of missiles fired by Player-2. Sample Input: - 5 E - 2 - Q 1 1 A1 B2 - P 2 1 D4 C3 - A1 B2 B2 B3 - A1 B2 B3 A1 D1 E1 D4 D4 D5 D5 Output: ```sh Player-1 fires a missile with target A1 which got miss Player-2 fires a missile with target A1 which got hit Player-2 fires a missile with target B2 which got miss Player-1 fires a missile with target B2 which got hit Player-1 fires a missile with target B2 which got hit Player-1 fires a missile with target B3 which got miss Player-2 fires a missile with target B3 which got miss Player-1 has no more missiles left to launch Player-2 fires a missile with target A1 which got hit Player-2 fires a missile with target D1 which got miss Player-1 has no more missiles left to launch Player-2 fires a missile with target E1 which got miss Player-1 has no more missiles left to launch Player-2 fires a missile with target D4 which got hit Player-2 fires a missile with target D4 which got miss Player-1 has no more missiles left to launch Player-2 fires a missile with target D5 which got hit Player-2 won the battle ``` #### PDF See [BattleShip_Game_V3.pdf](https://github.com/deepak-rathi/BattleShip/blob/master/BattleShip_Game_V3.pdf) ### Todos - Add Unit Test - Improve code and implement new architecture to support different user interface application using same code License ---- GNU GENERAL PUBLIC LICENSE Version 3

近期下载者

相关文件


收藏者