converting methods into pseudo codes
Hi all, can you convert some java codes methods from the card class in solitaire game into the pseudo codes. thanks
public class Card
{
public static boolean IsAceBiggest = true;
private String rank;
private String suit;
public String Color
public string NumberString
{
get
{
switch (rank)
{
case CardRank.Ace:
return "A";
case CardRank.Jack:
return "J";
case CardRank.Queen:
return "Q";
case CardRank.King:
return "K";
default:
return Number.ToString();
}
}
}
private Deck deck;
public Deck Deck
{
set
{
if (deck.Game != value.Game)
throw new InvalidOperationException("The new deck must be in the same game like the old deck of the card.");
if (deck != value)
{
deck.Cards.Remove(this);
deck = value;
deck.Cards.Add(this);
if (DeckChanged != null)
DeckChanged(this, null);
}
}
}
private boolean visible = true;
public boolean Visible
{
get
{
return visible;
}
set
{
if (visible != value)
{
visible = value;
if (VisibleChanged != null)
VisibleChanged(this, null);
}
}
}
private boolean enabled = true;
public boolean Enabled
{
get
{
return enabled;
}
set
{
enabled = value;
}
}
private boolean isDragable = true;
public boolean IsDragable
{
get { return isDragable; }
set { isDragable = value; }
}
public Card(CardRank rank, CardSuit suit, Deck deck)
{
this.rank = rank;
this.suit = suit;
this.deck = deck;
this.deck.Game.Cards.Add(this);
}
public Card(int number, CardSuit suit, Deck deck)
{
this.rank = (CardRank)number;
this.suit = suit;
this.deck = deck;
this.deck.Game.Cards.Add(this);
}
public int CompareTo(Card other)
{
int value1 = this.Number;
int value2 = other.Number;
if(Card.IsAceBiggest)
{
if (value1 == 1)
value1 = 14;
if (value2 == 1)
value2 = 14;
}
if (value1 > value2)
return 1;
else if (value1 < value2)
return -1;
else
return 0;
}
public void MoveToFirst()
{
MoveToIndex(0);
}
public void MoveToLast()
{
MoveToIndex(Deck.Cards.Count);
}
public void Shuffle()
{
MoveToIndex(Deck.Game.random.Next(0, Deck.Cards.Count));
}
public void MoveToIndex(int index)
{
Deck.Cards.Remove(this);
Deck.Cards.Insert(index, this);
}
public override string ToString()
{
return this.NumberString + " of " + this.Suit.ToString();
}
}
Re: converting methods into pseudo codes
Um...I'm sure many of us could, but it's unlikely we would.
I mean, this smacks of being your homework to me.
Re: converting methods into pseudo codes
That code isn't Java, it's a feeble attempt at C#; better ask at a Microsoft site.
kind regards,
Jos
Re: converting methods into pseudo codes
Actual code to psuedo code is easy. This is definitely a no brainer and you're asking for us to complete something for you. Good luck buddy.