Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [battleship]

A guessing game in which two players place ships on a grid, then take turns guessing the coordinates of the other player's ships

Filter by
Sorted by
Tagged with
3 votes
2 answers
106 views

battleship game with two ships per player

I'm creating a battleship game in Ruby. Let me explain how it works: The game is played on 5x5 grids (one per player). Players have 2 ships each to place on their grid. A small ship (3x1 side) and a ...
user avatar
  • 31
6 votes
2 answers
243 views

Console battleship game made in C

I started out to learn more about C to learn more about low level programming and hardware and I can improve. It generates a random number between 1 and 4 then stores it into two variables. It takes ...
user avatar
  • 63
3 votes
2 answers
147 views

BASIC Computer Games: Battle in C++

As a C++ newbie, I am practicing my C++ skill by implement games in BASIC Computer Games and here is my C++ version for Battle. Suggestions I want Any suggestion are welcome! Current Project code from ...
user avatar
0 votes
0 answers
19 views

Simple battleship game in Groovy

I am trying to learn Groovy and I did an attempt on implementing a simple Battleship game. Any feedback is welcome. I will start with the modal classes I have. Modal classes Coordinate.groovy ...
user avatar
  • 1,545
4 votes
1 answer
134 views

Python Battleship

I have implemented Battleship in Python by using lists. I have used threading to prevent KeyboardInterrupt, so the player can't cheat by using control-c and stuff. ...
user avatar
  • 137
8 votes
2 answers
591 views

Battleship with Java

I recently whipped up a Battleship program with Java as part of my Basic OOP class in university. The class is done but all we get are grades. I would really love, though, to know where and what I can ...
user avatar
  • 83
5 votes
1 answer
453 views

Battleship Game Field Generator

Summary I have been playing with Rust for a couple of days, so I thought I would implement something rather simple. This code generates a random variation of board for well-known game of Battleship. ...
user avatar
9 votes
3 answers
3k views

Single Player Python Battleship Game

I made a battleship game for a programming class, where I only had about a week to get it done. Under this time crunch, and the fact that I don't know python very well, I made some of the code in very ...
user avatar
  • 802
14 votes
5 answers
6k views

A Simple Battleship Game

I have just finished learning basic-intermediate Python subjects and wanted to test myself. This Battleship game is the third game i have written. ...
user avatar
  • 351
6 votes
3 answers
2k views

Battleships OOP python

This is my first attempt at some basic OOP programming. A version of battleships played within the terminal. Any feedback would be great; especially in regards to readability and proper naming ...
user avatar
4 votes
0 answers
103 views

Initial map modelling for Battleship game

The goal of the code below is limited to the creation of the initial map only and not to the whole game mechanics itself. The rules are that there are 4 ships of length {2,3,4,5} and no ship may be ...
user avatar
5 votes
1 answer
683 views

Ship placement verification function for Battleship game

I wrote a server-side Battleship game simulator in nodeJs/Javascript: A random player who begins is chosen. Both players place their ships. Software recognizes if they are placed correctly. One of ...
user avatar
  • 207
3 votes
2 answers
3k views

Battleship Game in Java

I wanted to make a very simply Battleship game in Java, any feedback is welcome. Nevermind the getters / setters. Just assume they are there. ...
user avatar
  • 1,545
3 votes
1 answer
2k views

C++ Battleship player AI

Found this project online and looking for some guidance. I'm in the process of developing a Battleship AI that will play against different computer difficulties. The "barebones" part of the project ...
user avatar
7 votes
0 answers
278 views

Web Battleship -The Unofficial Battleship UI

I've written my own UI for Mathieu Guindon's VBA Battleship (Battleship UI: GameSheet) which uses a webpage in a WebBrowser control for the View. Webform: Userform ...
user avatar
  • 4,028
3 votes
1 answer
334 views

Battleship Model - follow-up

This is the revised code from my prior question. Same requests as before! Something I'm doing new here is using the XmlEncoder extension methods to handle ...
user avatar
  • 2,897
4 votes
1 answer
375 views

Battleship Model

The following is some code for a Battleship game I'm working on. The plan is to create a multiplayer game using Xamarin Forms. This is just the model code, i.e. what the GUI will be interacting with ...
user avatar
  • 2,897
0 votes
2 answers
701 views

Battleships “AI” function

I would like some advice on how I could shorten my function from my battleships game (below). Essentially what it does is it checks if a coordinate is a hit and if it is, then if checks adjacent ...
user avatar
  • 9
8 votes
0 answers
628 views

Battleship MVC Architecture

The entry point is the Macros module, which - for now - includes only a single procedure, at a very high abstraction level - I'm quite happy with this: ...
user avatar
5 votes
1 answer
2k views

Java battle ship game

I am a beginner in the programming world. This is the first big project I tackle which is the battleships game. I implemented the game to run in the console. I was hoping if you guys can check my code ...
user avatar
  • 51
14 votes
0 answers
472 views

BattleShip - Ships & Players

I'm making a full-blown OOP Battleship game in VBA (previous post: Battleship Grid), and I want this code to be as good as it gets - and better, if I can. I've refactored a few things, introduced a <...
user avatar
1 vote
0 answers
233 views

Battleship game in python3 and the unicurses libary (oop)

In order to learn Python and Curses programming I am in the process of creating a Battleship game for the console. At the moment I struggle more on object oriented programming and structuring the ...
user avatar
12 votes
1 answer
334 views

BattleShip Grid: Classes and Tests

In my ongoing quest to demonstrate how VBA code can absolutely be object-oriented, I've started implementing a game of Battleship in pure VBA. This is a rather large project, so I'll split the ...
user avatar
3 votes
3 answers
200 views

Program creates 3 consecutive values on a 7x7 grid; User has to guess the location

I'm learning Java with Head First Java. I've built a program that creates a 7x7 grid (A0 to G6) and places an object of 3 consecutive values inside it. The user has to guess the location and when ...
user avatar
7 votes
1 answer
3k views

Find the battleship

This is my first attempt at anything in C#. It's based on battleships, but there's only one player and only one ship. The gameplay is super simple: just try to find the ship... keep guessing until ...
user avatar
  • 341
5 votes
2 answers
11k views

Java Battleship game

I have been given a problem statement to create a Battleship game in java. My working code (Spring Boot+Web) is placed here along with the problem statement. https://github.com/ankidaemon/BattleShip ...
user avatar
7 votes
2 answers
2k views

Simple Battleship written in Python

I would appreciate feedback on my first Battleship game written in Python for my intro to programming class. Here is the code, the only thing in here is that I use a clear screen function from one of ...
user avatar
3 votes
2 answers
3k views

Python battleship program (2 player or 1 player)

I recently started studying python with a much heavier study regimen, I wanted someone to review my code to see what they thought. I do have a to do list at the start of the code so any tips on how I ...
user avatar
11 votes
1 answer
865 views

Beginner Battleship game in Python/terminal

I am learning how to program and during the Python course on Codecademy I was encouraged to rewrite it all with new features (2 players, various ship sizes, etc.). In summary this works as follows: ...
user avatar
4 votes
2 answers
3k views

2-Player console-based modified Battleship game

I have written a simple Code using Array List, Scanner and String for Developing a Simple Console based 2- Player Battleship Game in Java The Complete Question can be found here Below is the ...
user avatar
3 votes
1 answer
1k views

2-player Game of Battleship (Python)

I have been working on a 2-player battleship game and have finally got it working, bug free. I'm posting this here to ask you what you think of it. Are there any changes that could be made to improve ...
user avatar
  • 345
7 votes
1 answer
6k views

2-player Battleship game Python

I have been working on a 2-player battleship game in Python. The game asked you to guess a row and column from a 5x5 game board before checking those coordinates to see if you have correctly guessed ...
user avatar
  • 345
4 votes
2 answers
435 views

Game of Battleship

I'm working on a 2-player battleships game in python, although the game is slightly buggy. It sometimes does not allow me to play another game once the first game has finished, and it does not change ...
user avatar
  • 345
3 votes
1 answer
554 views

Battleship coordinate picker

I present to you... my battleship location picker! This will be part of a larger battleship program. The coordinates that are important are finalcoords. ...
user avatar
  • 243
7 votes
2 answers
1k views

Battleship homework

It's a few weeks old homework, and it's already graded. How can I improve my code? Write function empty(n), which gets the board size as an argument, and returns ...
user avatar
5 votes
1 answer
2k views

Battleship Game

Inspired by this question, I went on with the following version. My goal was to focus on pure functions, to avoid mutable variables and to be strictly functional. I have ignored the computer player ...
user avatar
5 votes
2 answers
13k views

Python simple battleship game

I'm relatively new to Python, I decided to make a simple battleship game. Is there anything I should do to make it shorter, or in practice, "better"? ...
user avatar
11 votes
2 answers
5k views

Making a Battleship game

I'm making a Battleship game using python 2.7. However, how to make it is not currently my issue. The main aspect that I'm asking about is the style and method of making the code. Am I following ...
user avatar
6 votes
2 answers
4k views

Designing a simple Battleship game in Python

I am trying to code Battleship. It should be a text one-player game against computer where computer and human player take turns in shooting at opponent's ships. I decided to start implementation with ...
user avatar
  • 241
2 votes
1 answer
8k views

Battleship in Python TKinter

I am very new to GUI programming, and I'm pretty sure I'm doing it wrong. Please take a look at my code, and suggest some changes. I feel it's way too complicated for what it's actually doing. For ...
user avatar