Here is a class written in Java: package pieces; import model.Action; import…
- User
Here is a class written in Java: package pieces;
import model.Action; import model.Const; import model.Piece;
public class Aramis extends Piece { public Aramis(int owner) { super.setOwner(owner); super.setPieceType(ARAMIS); super.loadSide1(actionMatrix1); super.loadSide2(actionMatrix2); }
int[][] actionMatrix1 = { {0,0,0,0,0}, {Action.JUMP,Action.MOVE,Action.MOVE,Action.MOVE,Action.JUMP}, {0,0,Action.REFERENCEPOINT,0,0}, {0,Action.MOVE,0,Action.MOVE,0}, {Action.MOVE,0,0,0,Action.MOVE} }; int[][] actionMatrix2 = { {0,0,Action.JUMP,0,0}, {0,Action.STRIKE,Action.STRIKE,Action.STRIKE,0}, {0,0,Action.REFERENCEPOINT,0,0}, {0,0,Action.MOVE,0,0}, {0,0,Action.JUMP,0,0} };}
Please rewrite it in C#. Use the K&R curly braces standard.
- Assistant
using Model; using System; namespace Pieces { public class Aramis : Piece { private int[][] actionMatrix1 = new int[][] { new int[] { 0, 0, 0, 0, 0 }, new int[] { Action.JUMP, Action.MOVE, Action.MOVE, Action.MOVE, Action.JUMP }, new int[] { 0, 0, Action.REFERENCEPOINT, 0, 0 }, new int[] { 0, Action.MOVE, 0, Action.MOVE, 0 }, new int[] { Action.MOVE, 0, 0, 0, Action.MOVE } }; private int[][] actionMatrix2 = new int[][] { new int[] { 0, 0, Action.JUMP, 0, 0 }, new int[] { 0, Action.STRIKE, Action.STRIKE, Action.STRIKE, 0 }, new int[] { 0, 0, Action.REFERENCEPOINT, 0, 0 }, new int[] { 0, 0, Action.MOVE, 0, 0 }, new int[] { 0, 0, Action.JUMP, 0, 0 } }; public Aramis(int owner) { base.SetOwner(owner); base.SetPieceType(ARAMIS); base.LoadSide1(actionMatrix1); base.LoadSide2(actionMatrix2); } } } - User
Please rewrite the following Java code in C# using the K&R curly braces standard.:
using model;
namespace pieces { public class Archer : Piece { public Archer(int owner) { base.setOwner(owner); base.setPieceType(ARCHER); base.loadSide1(actionMatrix1); base.loadSide2(actionMatrix2); }
int[][] actionMatrix1 = { {0,0,0,0,0}, {0,Action.MOVE,0,Action.MOVE,0}, {0,Action.DEFENSE,Action.REFERENCEPOINT,Action.DEFENSE,0}, {0,Action.MOVE,0,Action.MOVE,0}, {0,0,0,0,0} };
int[][] actionMatrix2 = { {0,0,Action.NONCAPTUREMOVE,0,0}, {Action.STRIKE,0,Action.STRIKE,0,Action.STRIKE}, {0,Action.MOVE,Action.REFERENCEPOINT,Action.MOVE,0}, {0,Action.NONCAPTUREMOVE,Action.DEFENSE,Action.NONCAPTUREMOVE,0}, {0,0,0,0,0} }; } }
- Assistant
using Model;
namespace Pieces { public class Archer : Piece { private int[][] actionMatrix1 = new int[][] { new int[] { 0, 0, 0, 0, 0 }, new int[] { 0, Action.MOVE, 0, Action.MOVE, 0 }, new int[] { 0, Action.DEFENSE, Action.REFERENCEPOINT, Action.DEFENSE, 0 }, new int[] { 0, Action.MOVE, 0, Action.MOVE, 0 }, new int[] { 0, 0, 0, 0, 0 } };
private int[][] actionMatrix2 = new int[][] { new int[] { 0, 0, Action.NONCAPTUREMOVE, 0, 0 }, new int[] { Action.STRIKE, 0, Action.STRIKE, 0, Action.STRIKE }, new int[] { 0, Action.MOVE, Action.REFERENCEPOINT, Action.MOVE, 0 }, new int[] { 0, Action.NONCAPTUREMOVE, Action.DEFENSE, Action.NONCAPTUREMOVE, 0 }, new int[] { 0, 0, 0, 0, 0 } }; public Archer(int owner) { base.SetOwner(owner); base.SetPieceType(ARCHER); base.LoadSide1(actionMatrix1); base.LoadSide2(actionMatrix2); } }}