本文整理汇总了C#中AI.playerID方法的典型用法代码示例。如果您正苦于以下问题:C# AI.playerID方法的具体用法?C# AI.playerID怎么用?C# AI.playerID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AI
的用法示例。
在下文中一共展示了AI.playerID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(AI ai)
{
maxX = ai.mapWidth() - 1;
maxY = ai.mapHeight() - 1;
size = (maxX + 1) * (maxY + 1);
usId = ai.playerID();
themId = 1 - ai.playerID();
Truth = new BitArray(size).Not();
Reset();
init = true;
ReadBoard();
}
示例2: Init
public static void Init(AI new_ai)
{
ai = new_ai;
id = ai.playerID();
Width = ai.mapWidth();
Height = ai.mapHeight();
size = Width * Height;
DroidLookup = new Dictionary<Point, Droid>();
TileLookup = AI.tiles.ToDictionary(t => new Point(t.X, t.Y));
OurUnits = new BitArray(size);
TheirUnits = new BitArray(size);
OurClaws = new BitArray(size);
TheirClaws = new BitArray(size);
OurRepairers = new BitArray(size);
TheirRepairers = new BitArray(size);
OurTurrets = new BitArray(size);
TheirTurrets = new BitArray(size);
OurTerminators = new BitArray(size);
TheirTerminators = new BitArray(size);
OurArchers = new BitArray(size);
TheirArchers = new BitArray(size);
OurHackers = new BitArray(size);
TheirHackers = new BitArray(size);
OurWalls = new BitArray(size);
TheirWalls = new BitArray(size);
OurHangars = new BitArray(size);
TheirHangars = new BitArray(size);
OurSpawning = new BitArray(size);
TheirSpawning = new BitArray(size);
allBoards = new[]{
OurUnits, TheirUnits,
OurClaws, TheirClaws,
OurRepairers, TheirRepairers,
OurTurrets, TheirTurrets,
OurTerminators, TheirTerminators,
OurArchers, TheirArchers,
OurHackers, TheirHackers,
OurWalls, TheirWalls,
OurHangars, TheirHangars,
OurSpawning, TheirSpawning
};
}
示例3: Update
public static void Update(AI ai)
{
OurStarfishMap.SetAll(false);
OurSpongesMap.SetAll(false);
OurAngelfishesMap.SetAll(false);
OurSnailsMap.SetAll(false);
OurUrchinsMap.SetAll(false);
OurOctopiMap.SetAll(false);
OurTomcodsMap.SetAll(false);
OurSharksMap.SetAll(false);
OurCuttlefishesMap.SetAll(false);
OurShrimpsMap.SetAll(false);
OurEelsMap.SetAll(false);
OurJellyfishMap.SetAll(false);
TheirStarfishMap.SetAll(false);
TheirSpongesMap.SetAll(false);
TheirAngelfishesMap.SetAll(false);
TheirSnailsMap.SetAll(false);
TheirUrchinsMap.SetAll(false);
TheirOctopiMap.SetAll(false);
TheirTomcodsMap.SetAll(false);
TheirSharksMap.SetAll(false);
TheirCuttlefishesMap.SetAll(false);
TheirShrimpsMap.SetAll(false);
TheirEelsMap.SetAll(false);
TheirJellyfishMap.SetAll(false);
OurStarfishSet.Clear();
OurSpongesSet.Clear();
OurAngelfishesSet.Clear();
OurSnailsSet.Clear();
OurUrchinsSet.Clear();
OurOctopiSet.Clear();
OurTomcodsSet.Clear();
OurSharksSet.Clear();
OurCuttlefishesSet.Clear();
OurShrimpsSet.Clear();
OurEelsSet.Clear();
OurJellyfishSet.Clear();
TheirStarfishSet.Clear();
TheirSpongesSet.Clear();
TheirAngelfishesSet.Clear();
TheirSnailsSet.Clear();
TheirUrchinsSet.Clear();
TheirOctopiSet.Clear();
TheirTomcodsSet.Clear();
TheirSharksSet.Clear();
TheirCuttlefishesSet.Clear();
TheirShrimpsSet.Clear();
TheirEelsSet.Clear();
TheirJellyfishSet.Clear();
FishMap.SetAll(false);
TheirFishMap.SetAll(false);
OurFishMap.SetAll(false);
TrashMap.SetAll(false);
OurTrashMap.SetAll(false);
TheirTrashMap.SetAll(false);
//update fish maps
foreach (var fish in BaseAI.fishes)
{
FishMap[GetOffset(fish.X, fish.Y)] = true;
if (fish.Owner == ai.playerID())
{
OurFishMap[GetOffset(fish.X, fish.Y)] = true;
switch (fish.Species)
{
case 0:
OurStarfishMap[GetOffset(fish.X, fish.Y)] = true;
OurStarfishSet.Add(fish);
break;
case 1:
OurSpongesMap[GetOffset(fish.X, fish.Y)] = true;
OurSpongesSet.Add(fish);
break;
case 2:
OurAngelfishesMap[GetOffset(fish.X, fish.Y)] = true;
OurAngelfishesSet.Add(fish);
break;
case 3:
OurSnailsMap[GetOffset(fish.X, fish.Y)] = true;
OurSnailsSet.Add(fish);
break;
case 4:
OurUrchinsMap[GetOffset(fish.X, fish.Y)] = true;
OurUrchinsSet.Add(fish);
break;
case 5:
OurOctopiMap[GetOffset(fish.X, fish.Y)] = true;
OurOctopiSet.Add(fish);
break;
case 6:
OurTomcodsMap[GetOffset(fish.X, fish.Y)] = true;
OurTomcodsSet.Add(fish);
break;
case 7:
//.........这里部分代码省略.........
示例4: init
public static void init(AI ai)
{
MaxX = ai.mapWidth();
MaxY = ai.mapHeight();
OurReef = new BitArray(AI.tiles.Length);
TheirReef = new BitArray(AI.tiles.Length);
NeutralReef = new BitArray(AI.tiles.Length);
FishMap = new BitArray(AI.tiles.Length);
OurFishMap = new BitArray(AI.tiles.Length);
TheirFishMap = new BitArray(AI.tiles.Length);
WallMap = new BitArray(AI.tiles.Length);
TrashMap = new BitArray(AI.tiles.Length);
OurTrashMap = new BitArray(AI.tiles.Length);
TheirTrashMap = new BitArray(AI.tiles.Length);
CoveMap = new BitArray(AI.tiles.Length);
OurCoveMap = new BitArray(AI.tiles.Length);
TheirCoveMap = new BitArray(AI.tiles.Length);
OurStarfishMap = new BitArray(AI.tiles.Length);
OurSpongesMap = new BitArray(AI.tiles.Length);
OurAngelfishesMap = new BitArray(AI.tiles.Length);
OurSnailsMap = new BitArray(AI.tiles.Length);
OurUrchinsMap = new BitArray(AI.tiles.Length);
OurOctopiMap = new BitArray(AI.tiles.Length);
OurTomcodsMap = new BitArray(AI.tiles.Length);
OurSharksMap = new BitArray(AI.tiles.Length);
OurCuttlefishesMap = new BitArray(AI.tiles.Length);
OurShrimpsMap = new BitArray(AI.tiles.Length);
OurEelsMap = new BitArray(AI.tiles.Length);
OurJellyfishMap = new BitArray(AI.tiles.Length);
TheirStarfishMap = new BitArray(AI.tiles.Length);
TheirSpongesMap = new BitArray(AI.tiles.Length);
TheirAngelfishesMap = new BitArray(AI.tiles.Length);
TheirSnailsMap = new BitArray(AI.tiles.Length);
TheirUrchinsMap = new BitArray(AI.tiles.Length);
TheirOctopiMap = new BitArray(AI.tiles.Length);
TheirTomcodsMap = new BitArray(AI.tiles.Length);
TheirSharksMap = new BitArray(AI.tiles.Length);
TheirCuttlefishesMap = new BitArray(AI.tiles.Length);
TheirShrimpsMap = new BitArray(AI.tiles.Length);
TheirEelsMap = new BitArray(AI.tiles.Length);
TheirJellyfishMap = new BitArray(AI.tiles.Length);
OurDeepestReef = new BitArray(AI.tiles.Length);
TheirDeepestReef = new BitArray(AI.tiles.Length);
//Fill Reef Maps
foreach (var tile in BaseAI.tiles)
{
if (tile.Damages == ai.playerID())
{
OurReef[GetOffset(tile.X, tile.Y)] = true;
}
else if (tile.Damages == 1 - ai.playerID())
{
TheirReef[GetOffset(tile.X, tile.Y)] = true;
}
else
{
NeutralReef[GetOffset(tile.X, tile.Y)] = true;
}
}
if (ai.getTile(MaxX-1, 0).Damages == ai.playerID())
{
foreach (Tile t in BaseAI.tiles)
{
if (t.X == MaxX - 1 || t.X == MaxX - 2)
{
OurDeepestReef[GetOffset(t.X, t.Y)] = true;
}
else if (t.X == 0 || t.X == 1)
{
TheirDeepestReef[GetOffset(t.X, t.Y)] = true;
}
}
}
else
{
foreach (Tile t in BaseAI.tiles)
{
if (t.X == MaxX - 1 || t.X == MaxX - 2)
{
TheirDeepestReef[GetOffset(t.X, t.Y)] = true;
}
else if (t.X == 0 || t.X == 1)
{
OurDeepestReef[GetOffset(t.X, t.Y)] = true;
}
}
}
//BaseAI.fishes.ToList().ForEach(fish => FishMap.Set(GetOffset(fish.X, fish.Y), true));
//fill fish maps
//.........这里部分代码省略.........
示例5: Initialize
// initializes and populates the bitboards
public static void Initialize(AI ai)
{
// initialize player ids
foreach (Player player in BaseAI.players)
{
if (player.Id == ai.playerID())
{
myID = player.Id;
}
else
{
oppID = player.Id;
}
}
// initialize bitboard dimensions
width = ai.mapWidth();
height = ai.mapHeight();
length = width * height;
// initialize constant bitboards
empty = new BitArray(length, false);
full = new BitArray(length, true);
topEdge = new BitArray(length, false);
bottomEdge = new BitArray(length, false);
for (int i = 0; i < width; i++)
{
topEdge.Set((i * height), true);
bottomEdge.Set((i * height) + (height - 1), true);
}
validLeft = new BitArray(length, false).Or(bottomEdge).Xor(full);
validRight = new BitArray(length, false).Or(topEdge).Xor(full);
position = new BitArray[width][];
for (int i = 0; i < width; i++)
{
position[i] = new BitArray[height];
for (int j = 0; j < height; j++)
{
position[i][j] = new BitArray(length, false);
SetBit(position[i][j], i, j, true);
}
}
// initialize type-specific bitboards
myPumpStations = new BitArray(length, false);
mySpawnBases = new BitArray(length, false);
mySpawningSquares = new BitArray(length, false);
myWorkers = new BitArray(length, false);
myScouts = new BitArray(length, false);
myTanks = new BitArray(length, false);
oppPumpStations = new BitArray(length, false);
oppSpawnBases = new BitArray(length, false);
oppSpawningSquares = new BitArray(length, false);
oppWorkers = new BitArray(length, false);
oppScouts = new BitArray(length, false);
oppTanks = new BitArray(length, false);
waterTiles = new BitArray(length, false);
trenchTiles = new BitArray(length, false);
dirtTiles = new BitArray(length, false);
iceCaps = new BitArray(length, false);
foreach (Tile tile in BaseAI.tiles)
{
switch (tile.Owner)
{
case 2: // neutral tile
if (tile.Depth == 0) // dirt tile
{
SetBit(dirtTiles, tile.X, tile.Y, true);
}
else if (tile.WaterAmount == 0) // trench tile
{
SetBit(trenchTiles, tile.X, tile.Y, true);
}
else // water tile
{
SetBit(waterTiles, tile.X, tile.Y, true);
}
break;
case 3: // ice cap
SetBit(iceCaps, tile.X, tile.Y, true);
break;
default:
if (tile.Owner == myID) // my tile
{
if (tile.PumpID != -1) // my pump station
{
SetBit(myPumpStations, tile.X, tile.Y, true);
}
else if (tile.IsSpawning) // my spawning square
{
SetBit(mySpawningSquares, tile.X, tile.Y, true);
}
else // my spawn base
{
SetBit(mySpawnBases, tile.X, tile.Y, true);
}
}
//.........这里部分代码省略.........