XNA Battleship
Monday, February 11 2008 - xna, game-development
This is a good example to show how easy it is to put a game together with the XNA Framework. The author here has put together a good small version of Battleship using the XNA Framework.
In this example it took Dubayou about 4 hours to put it together (With some more time to work on the Graphics).
"I haven’t posted in a while so i figured I would mention a game i am working on for my computer science 421 game development class. It had to be a 2d game and since i have already started on my 3d game using the Irrlicht Engine i choose to go with Microsoft XNA Framework to develop on. I wrote the main functionality of the game in a little under 4 hours last Saturday. And have done a handfull of revisions to the GFX over the last 48 hrs. More info on this game can be found on its new project page ( http://www.dubayou.com/xnabattleship/)."
Here is a Direct Link to the Download Page.
Similar Posts
- Creating a DiggIt Module for Community Server 2007
- Book Review - XNA Game Studio Creator's Guide
- Nazeeh talks Game Design and XNA

Funny, just wrote a theoretical battleship game in
notepad to try out an approach for a generic
gameGrid in C# 3 with the least possible game specific
code in the grid class.
Totally untested and of course you would have to
implement the Grid and Square types..
Don't know if the code could work in C#.
map = new Grid(7,7)
validSquare = (Square s) => {s.in(b2,f6) &&
s.around.all(isEmpty())}
map.placeShapes("x,xx,xxx,xxxx", validSquare)
computer = new Grid(7,7)
computer.randomShapes("x,xx,xxx,xxxx", validSquare)
map.caption = "You"
computer.caption = "Computer"
while (true)
{
computer.selectSquare(playerSelect);
map.selectRandomSquare(computerSelect);
}
playerSelect = (Square s) =>
{
if !(s.inShape())
{ s.color = blue; }
else
{
s.color = red;
if (s.grid.shapes().squares().all({color == red})
winGame()
else
{
if (s.shape().squares().all({color == red})
s.shape.squares().around().color = blue;
s.grid.selectSquare(playerSelect);
}
}
};
computerSelect = (Square s) =>
{
if !(s.isEmpty())
{s.grid.selectRandomSquare(computerSelect);}
else
{
if !(s.inShape())
{ s.color = blue; }
else
{
s.color = red;
if (s.grid.shapes().squares().all({color == red})
looseGame()
else
{
if (s.shape().squares().all({color == red})
{
s.shape.squares().around().color = blue;
s.grid.selectRandomSquare(computerSelect);
}
else
s.grid.selectRandomSquareNear(s,computerSelect);
}
}
}
};
void winGame() {print &q