Att: C# Programmør Re: Spil Visionen
Posted: 05 Mar 2010, 04:45
Hmm hvorfor putte mit program i showcase...well, måske kunne jeg få en kommentar eller et godt råd. Nå men jeg dykker direkte:
Noget af det er bagvendt noget ikke eksisterende, men glæder mig til at høre fra jer.
The@ngelMan
Code: Select all
///////////////////////////////////////////////////////////////////////////////
/// _______ __ __ ______ __ _____ _____ __ _____
/// |__ __| | | | | | ____/ / / | _ | | _ | ____ < | | _ |
/// | | | |_| | | |____ \| | |_| | |__ | | | | | | |_| |
/// |_| |_______| |______| |_____| |__| --- |_| |_____|
///
/// _=====_ _=====_
/// / _____ \ / _____ \
/// +.-'_____'-.---------------------------.-'_____'-.+
/// / | | '. .' | _ | \
/// / ___| /|\ |___ \ / ___| /_\ |___ \
/// / | | | ; __ _ ; | _ _ | ;
/// | | <--- ---> | | |__| |_:> | ||_| (_)| |
/// | |___ | ___| ;SELECT START ; |___ ___| ;
/// |\ | \|/ | / _ ___ _ \ | (X) | /|
/// | \ |_____| .','" "', |___| ,'" "', '. |_____| .' |
/// | '-.______.-' / \ANALOG/ \ '-._____.-' |
/// | | |------| | |
/// | /\ / \ /\ |
/// | / '.___.' '.___.' \ |
/// | / \ |
/// \ / \ /
/// \________/ \_________/
/// IV@NOV(Tm) by moonToy(c) is a Day and Night Imagination(R) Production
///
///////////////////////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using GameLogic;
namespace GameLogic
{
public class Form1 : System.Windows.Forms.Form
{
private IContainer components;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.MenuItem menuItem2;
private MenuItem menuItem1;
private MainMenu File;
private MenuItem menuItem4;
private MenuItem menuItem5;
private MenuItem menuItem6;
private MenuItem menuItem7;
private MenuItem menuItem8;
private MenuItem menuItem9;
private MenuItem menuItem10;
private MenuItem menuItem11;
private System.Windows.Forms.MenuItem menuItem3;
public Form1()
{
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.File = new System.Windows.Forms.MainMenu(this.components);
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 270);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Run";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button_Click);
//
// menuItem2
//
this.menuItem2.Index = -1;
this.menuItem2.Text = "Inline";
//
// menuItem3
//
this.menuItem3.Index = -1;
this.menuItem3.Text = "Obtion";
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem4});
this.menuItem1.Text = "Core";
//
// menuItem4
//
this.menuItem4.Index = 0;
this.menuItem4.Text = "Logon";
//
// File
//
this.File.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem5,
this.menuItem6,
this.menuItem7,
this.menuItem8,
this.menuItem9,
this.menuItem10,
this.menuItem11});
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.Text = "Stats";
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "Resurces";
//
// menuItem7
//
this.menuItem7.Index = 3;
this.menuItem7.Text = "Gear";
//
// menuItem8
//
this.menuItem8.Index = 4;
this.menuItem8.Text = "Inventory";
//
// menuItem9
//
this.menuItem9.Index = 5;
this.menuItem9.Text = "Buffs";
//
// menuItem10
//
this.menuItem10.Index = 6;
this.menuItem10.Text = "Spells";
//
// menuItem11
//
this.menuItem11.Index = 7;
this.menuItem11.Text = "Interrupt";
//
// Form1
//
this.ClientSize = new System.Drawing.Size(504, 305);
this.Controls.Add(this.button1);
this.Menu = this.File;
this.Name = "Form1";
this.Text = "++IV@NOV++";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
protected void button_Click(object sender, System.EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void logonToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
class Represent
{
public const string mithril = "Mithril";
public const string gold = "Gold";
public const string stone = "Gem";
public const string food = "Food";
public const string water = "Water";
public const string fuel = "Parts";
public const string kStart = "Butik";
public const string kEnd = "Fængsel";
public string kStatus;
public int kValue;
public int Dice(int numberSides)
{
double raw;
double big;
double bigger;
int die;
Random generator = new Random();
raw = generator.NextDouble();
big = raw * numberSides;
bigger = big + 1;
die = (int)bigger;
return die;
}
public void Creature()
{
}
public void butik(bool shopping)
{
WorldRender wr = new WorldRender();
if (shopping == true)
;
else if (shopping != true)
wr.locationNow = this.Dice(26);
}
public string message(string message)
{
if (message == "Food")
;
else if (message == "Water")
;
return message;
}
public int count(int steeps)
{
int showKnowlegeInventory = 1;
return showKnowlegeInventory + steeps;
}
public string resurces(string inputString)
{
string result = "";
string space = ", ";
switch (inputString)
{
case "0":
result += kStart;
break;
case "1":
result += mithril;
break;
case "2":
result += gold;
break;
case "3":
result += stone;
break;
case "4":
result += food;
break;
case "5":
result += water;
break;
case "6":
result += fuel;
break;
case "7":
result += mithril;
result += space;
result += stone;
break;
case "8":
result += mithril;
result += space;
result += gold;
result += space;
result += stone;
break;
case "9":
result += gold;
result += space;
result += stone;
break;
case "10":
result += mithril;
result += space;
result += water;
result += space;
result += stone;
break;
case "11":
result += stone;
result += space;
result += food;
result += space;
result += gold;
break;
case "12":
result += water;
result += space;
result += stone;
result += space;
result += food;
break;
case "13":
result += water;
result += space;
result += stone;
break;
case "14":
result += food;
result += space;
result += stone;
break;
case "15":
result += food;
result += space;
result += gold;
break;
case "16":
result += food;
result += space;
result += water;
break;
case "17":
result += mithril;
result += space;
result += gold;
break;
case "18":
result += mithril;
result += space;
result += water;
break;
case "19":
result += mithril;
result += space;
result += fuel;
result += space;
result += water;
break;
case "20":
result += food;
result += space;
result += gold;
result += space;
result += fuel;
break;
case "21":
result += mithril;
result += space;
result += gold;
result += space;
result += fuel;
break;
case "22":
result += gold;
result += space;
result += fuel;
break;
case "23":
result += mithril;
result += space;
result += fuel;
break;
case "24":
result += food;
result += space;
result += water;
break;
case "25":
result += water;
result += space;
result += fuel;
break;
case "26":
result += food;
result += space;
result += water;
result += space;
result += fuel;
break;
}
return result;
}
public void state(string stateChoise)
{
}
}
class Ai
{
public void Choise()
{
Represent rp = new Represent();
Update up = new Update();
WorldRender wr = new WorldRender();
switch(rp.Dice(1))
{
case 1:
wr.status = 1;
wr.Count();
break;
case 2:
wr.status = 2;
wr.Count();
break;
case 3:
wr.status = 3;
wr.Count();
break;
case 4:
wr.status = 4;
wr.Count();
break;
case 5:
wr.status = 5;
wr.Count();
break;
case 6:
wr.status = 6;
wr.Count();
break;
}
}
public void External()
{
Application.Run(new Form1());
}
}
class WorldRender
{
public int status;
public int locationNow;
public int pro;
public int steeps;
public void Count()
{
Represent rp = new Represent();
Update up = new Update();
if (this.status == 1)
{
int x;
int y;
int z;
int adderX, adderY, adderZ;
adderX = rp.Dice(3);
adderY = rp.Dice(3);
adderZ = rp.Dice(3);
x = adderX - 1;
y = adderY - 1;
z = adderZ - 1;
this.locationNow = up.Field(x, y, z);
Console.WriteLine(rp.resurces(this.locationNow.ToString()));
rp.kValue = this.locationNow;
up.Internal(true);
}
else if (this.status == 2)
{
int i;
bool k = true;
for (i = 0; i < 27; ++i)
if (this.locationNow == i)
{
switch (i)
{
case 1:
up.kMithril++;
break;
case 2:
up.kGold++;
break;
case 3:
up.kStone++;
break;
case 4:
up.kFood++;
break;
case 5:
up.kWater++;
break;
case 6:
up.kFuel++;
break;
case 7:
up.kMithril++;
up.kStone++;
break;
case 8:
up.kMithril++;
up.kGold++;
up.kStone++;
break;
case 9:
up.kGold++;
up.kStone++;
break;
case 10:
up.kMithril++;
up.kWater++;
up.kStone++;
break;
case 11:
up.kStone++;
up.kFood++;
up.kGold++;
break;
case 12:
up.kWater++;
up.kStone++;
up.kFood++;
break;
case 13:
up.kWater++;
up.kStone++;
break;
case 14:
up.kFood++;
up.kStone++;
break;
case 15:
up.kFood++;
up.kGold++;
break;
case 16:
up.kFood++;
up.kWater++;
break;
case 17:
up.kMithril++;
up.kGold++;
break;
case 18:
up.kMithril++;
up.kWater++;
break;
case 19:
up.kMithril++;
up.kFuel++;
up.kWater++;
break;
case 20:
up.kFood++;
up.kGold++;
up.kFuel++;
break;
case 21:
up.kMithril++;
up.kGold++;
up.kFuel++;
break;
case 22:
up.kGold++;
up.kFuel++;
break;
case 23:
up.kMithril++;
up.kFuel++;
break;
case 24:
up.kFood++;
up.kWater++;
break;
case 25:
up.kWater++;
up.kFuel++;
break;
case 26:
up.kFood++;
up.kWater++;
up.kFuel++;
break;
}
}
else if (this.locationNow != i)
{
if (this.locationNow == 0)
up.Internal(true);
}
up.Internal(k);
}
else if (this.status == 3)
{
int statement = rp.Dice(2);
switch (statement)
{
case 1:
if (up.kFood != 0)
--up.kFood;
else if (up.kFood == 0) rp.state(rp.message("Food"));
break;
case 2:
if (up.kWater != 0)
--up.kWater;
else if (up.kWater == 0) rp.state(rp.message("Water"));
break;
}
up.Internal(true);
}
else if (this.status == 4)
{
while (this.status == 4)
{
int j = 0;
for (int i = 0; i < rp.kValue; )
while (i < this.locationNow)
{
for (j = 0; i==j ; )
rp.butik(true);
for (j = 0; i > j; )
up.Internal(true);
}
for (int i = 0; i == rp.kValue; )
while (i <= this.locationNow)
{
for (j = 0; i == j; )
rp.butik(true);
for (j = 0; i > j; )
up.Internal(true);
}
}
}
else if (this.status == 5)
{
do
{
if (this.locationNow != 0)
{
this.locationNow = 0;
}
else if (this.locationNow == 0)
up.Internal(true); ;
}
while (this.locationNow == 0);
rp.butik(true);
}
else if (this.status == 6)
{
;
}
}
}
class Update
{
Represent rps = new Represent();
WorldRender wrd = new WorldRender();
Ai ai = new Ai();
public int kMithril;
public int kGold;
public int kStone;
public int kFood;
public int kWater;
public int kFuel;
public int Field(int x, int y, int z)
{
int[, ,] matrix = new int[3, 3, 3];
matrix[0, 0, 0] = 0; //kStart
matrix[1, 0, 0] = 1; //kMithril
matrix[0, 1, 0] = 2; //kGold
matrix[0, 0, 1] = 3; //kStone
matrix[2, 0, 0] = 4; //kFood
matrix[0, 2, 0] = 5; //kWater
matrix[0, 0, 2] = 6; //kFuel
matrix[1, 0, 1] = 7; //kMithril && kStone
matrix[1, 1, 1] = 8; //kMithril && kGold && kStone
matrix[0, 1, 1] = 9; //kGold && kStone
matrix[1, 2, 1] = 10; //kMithril && kWater && kStone
matrix[2, 1, 1] = 11; //kFood && kGold && kStone
matrix[2, 2, 1] = 12; //kFood && kWater && kStone
matrix[0, 2, 1] = 13; //kWater && kStone
matrix[2, 0, 1]= 14; //kFood && kStone
matrix[2, 1, 0] = 15; //kFood && kGold
matrix[2, 2, 0] = 16; //kFood && kWater
matrix[1, 1, 0] = 17; //kMithril && kGold
matrix[1, 2, 0] = 18; //kMithril && kWater
matrix[1, 2, 2] = 19; //kMithril && kWater && kFuel
matrix[2, 1, 2] = 20; //kFood && kGold && kFuel
matrix[1, 1, 2] = 21; //kMithril && kGold && kFuel
matrix[0, 1, 2] = 22; //kGold && kFuel
matrix[1, 0, 2] = 23; //kMithril && kFuel
matrix[2, 0, 2] = 24; //kFood && kFuel
matrix[0, 2, 2] = 25; //kWater && kFuel
matrix[2, 2, 2] = 26; //kFood && kWater && kFuel
return matrix[x, y, z];
}
public void Internal(bool orient)
{
char[] direction = new char[4] {'n','s','e','w'};
while (orient != false)
{
wrd.steeps = rps.count(wrd.steeps);
}
}
}
}
class Namespace
{
public void Run()
{
Ai a = new Ai();
WorldRender w = new WorldRender();
Update u = new Update();
Represent r = new Represent();
w.locationNow = u.Field(0, 0, 0);
a.External();
a.Choise();
r.Creature();
Console.ReadKey();
}
public static void Main()
{
Namespace ns = new Namespace();
ns.Run();
}
}
The@ngelMan