Making even a simple game like stratego assumes you know how to program first and know the basic concepts. The best part of programming is tackling the problem first so you can try it your own way before reading the rest of this. If you get stuck look at the rest of what I've written for some ideas.
I'm going to take a long shot and assume that you haven't learned object oriented programming? If you have then this will be much easier.
If you do this via the console I'd use a multidimensional array (meaning a 2D array). "Dim gameBoard(10, 10) As Cell" (where Cell is a class). In this way you can represent all the units in the game as character symbols on the board.
You can even set the color of the console text! So each player would either be red or blue.
http://addressof.com/blog/articles/227.aspx
Someone at codeproject wrote a wrapper for it.
http://www.codeproject.com/KB/vb/color_console.aspx
The game would begin by asking the player where to place the pieces and the player would respond with an x and y value in the grid map for each unit. Then the same would be asked for the other player (unless there's an AI). Rendering the grid map would be easy. You'd use a nested for loop like:
(C# code)
Code:
using System;
using System.Text;
namespace Stratego
{
class Program
{
// W = water
static Cell[,] gameBoard = new Cell[10, 10];
static void Main(string[] args)
{
ResetGameBoard();
DrawBoard();
Console.ReadKey();
}
public struct Cell
{
public char character;
int playerNumber;
}
static void ResetGameBoard()
{
for (int y = 0; y < 10; ++y)
{
for (int x = 0; x < 10; ++x)
{
gameBoard[x, y].character = ' ';
}
}
gameBoard[2, 4].character = 'W';
gameBoard[3, 4].character = 'W';
gameBoard[2, 5].character = 'W';
gameBoard[3, 5].character = 'W';
gameBoard[6, 4].character = 'W';
gameBoard[7, 4].character = 'W';
gameBoard[6, 5].character = 'W';
gameBoard[7, 5].character = 'W';
}
static void DrawBoard()
{
for (int y = -1; y <= 10; ++y)
{
for (int x = -1; x <= 10; ++x)
{
if ((x + 1) % 11 == 0 && (y + 1) % 11 == 0)
{
Console.Write(" ");
}
else if ((y + 1) % 11 == 0)
{
Console.Write(x.ToString());
}
else if ((x + 1) % 11 == 0)
{
Console.Write(y.ToString());
}
else
{
Console.Write(gameBoard[x, y].character);
}
}
System.Console.Write("\n");
}
}
}
}
That code outputs:
Code:
0123456789
0 0
1 1
2 2
3 3
4 WW WW 4
5 WW WW 5
6 6
7 7
8 7
9 8
0123456789
If you get stuck with something specific feel free to ask. I wrote this in C# so that you can't copy and paste.
