我想开发一个棋盘游戏。我可以只使用 Windows 窗体应用程序创建它吗?我不想使用 XNA 。如果可以使用 windows 窗体应用程序创建,我如何将其转换为可执行文件。我不想将它作为控制台应用程序运行。我想将它创建为 Game 。
/*
It is a board game.
15 14 13 12 11 10 9
16 28 29 30 31 32 8
17 27 42 43 44 33 7
18 26 41 48 45 34 6
19 25 40 47 46 35 5
20 24 39 38 37 36 4
21 22 23 0 1 2 3
It is my board structure . Player one starts at square 0 . If he puts one , he will
get into the game . Then he can move his coin up to 23.He can get into 24 , if he
already cut the other player coins . Cut in the sense , player 0 places his coin on a
square that contains another player coins.Then he can move his coin from 24 to 48 .
when the coin reaches 48 , it will be completed . If player 0 completes his 6 coins
first , he will be the winner .
*/
namespace ConsoleApplication1
{
class Program
{
public static int playerCount;
public static int totalSquares = 49;
public static int totalCoins = 6;
public static bool errorFlag = false;
public static bool flagrepeat = false;
public static bool winner=false;
static void Main()
{
if (ErrorTypes.errors==null)
{
ErrorTypes.addMessage();
}
getPlayers(); // To get the number of players
startGame();// It will get the name of the player and
// will thorw exception if anything goes wrong and will
// call the main function again.
}
/*
* If a coin reaches center square , then it completes
* A player wins if he completes all the six coins
*/
public static void setWinner(player[] obj)
{
for (int k = 0; k < Program.playerCount; k++)
{
if (obj[k].completedcoins == 6)
{
Console.WriteLine("Winner is player " + (k + 1));
winner = true;
break;
}
}
}
public static void play(player[] obj)
{
bool rollrepeat; // If a player puts one or five or six , he will get another chance.
board boards = new board(); // It contains 49 squares
List<int> rollstore = new List<int>(10); // To store the rolls of a single player.
// Eg is [6,5,6,2] . Coz no repeat for 2. so his turn ends . Now he has to move the coin by selecting coin and //rollindex.
List<int> temprollstore = new List<int>(10);
int roll;
bool final = false;
int i = 0;
Random rn = new Random(); // To generate roll
bool flag = false, tempflag = false;
int[] pos;
while (true)
{
if (!gameover())
{
setWinner(obj);
if (final == false)
{
i = 0;
while (i < Program.playerCount)
{
/*
* to reset the flags so that another player can use it
*/
if (flag == true || flagrepeat == true)
{
flagrepeat = false;
flag = false;
}
/*
*
*/
while (true)
{
// This part of the does the job of storing the rolls and call the move function
// when the roll ends
}
}
print(obj);
Console.WriteLine("\n\nPress a Key To Go Next Round ");
Console.ReadKey();
}
else
{
break;
}
}
}
}
请建议我创建板并将硬币放在广场上的方法。