Commit e5c08ae4 authored by nargessalehi98's avatar nargessalehi98

cards preview

parent ac3a1766
......@@ -7,9 +7,9 @@ public class Cards {
public static final String yellow = "\u001B[33m";
public static final String blue = "\u001B[34m";
private String YSkip = yellow + "\u2503skip\u2503";
private String YRotate = yellow + "\u2503rvrs\u2503";
private String YPlus2 = yellow + "\u2503 +2 \u2503";
private String Yskip = yellow + "\u2503skp\u2503";
private String Yrotate = yellow + "\u2503rvs\u2503";
private String Yplus2 = yellow + "\u2503+ 2\u2503";
private String Y0 = yellow + "\u2503 0 \u2503";
private String Y1 = yellow + "\u2503 1 \u2503";
private String Y2 = yellow + "\u2503 2 \u2503";
......@@ -21,9 +21,9 @@ public class Cards {
private String Y8 = yellow + "\u2503 8 \u2503";
private String Y9 = yellow + "\u2503 9 \u2503";
private String BSkip = blue + "\u2503skip\u2503";
private String BRotate = blue + "\u2503rvrs\u2503";
private String BPlus2 = blue + "\u2503 +2 \u2503";
private String Bskip = blue + "\u2503skp\u2503";
private String Brotate = blue + "\u2503rvs\u2503";
private String Bplus2 = blue + "\u2503+ 2\u2503";
private String B0 = blue + "\u2503 0 \u2503";
private String B1 = blue + "\u2503 1 \u2503";
private String B2 = blue + "\u2503 2 \u2503";
......@@ -35,9 +35,9 @@ public class Cards {
private String B8 = blue + "\u2503 8 \u2503";
private String B9 = blue + "\u2503 9 \u2503";
private String RSkip = red + "\u2503skip\u2503";
private String RRotate = red + "\u2503rvrs\u2503";
private String RPlus2 = red + "\u2503 +2 \u2503";
private String Rskip = red + "\u2503skp\u2503";
private String Rrotate = red + "\u2503rvs\u2503";
private String Rplus2 = red + "\u2503+ 2\u2503";
private String R0 = red + "\u2503 0 \u2503";
private String R1 = red + "\u2503 1 \u2503";
private String R2 = red + "\u2503 2 \u2503";
......@@ -49,9 +49,9 @@ public class Cards {
private String R8 = red + "\u2503 8 \u2503";
private String R9 = red + "\u2503 9 \u2503";
private String GSkip = green + "\u2503skip\u2503";
private String GRotate = green + "\u2503rvrs\u2503";
private String GPlus2 = green + "\u2503 +2 \u2503";
private String Gskip = green + "\u2503skp\u2503";
private String Grotate = green + "\u2503rvs\u2503";
private String Gplus2 = green + "\u2503+ 2\u2503";
private String G0 = green + "\u2503 0 \u2503";
private String G1 = green + "\u2503 1 \u2503";
private String G2 = green + "\u2503 2 \u2503";
......@@ -63,9 +63,8 @@ public class Cards {
private String G8 = green + "\u2503 8 \u2503";
private String G9 = green + "\u2503 9 \u2503";
//14
private String wildPlus4 = black + "\u2503+4🌈" + green + black + "\u2503";
private String wildColor = black + "\u2503" + " 🌈 " + green + black + "\u2503";
private String wildPlus4 = black + "\u2503"+blue+"+ "+red+"4"+ black + "\u2503";
private String wildColor = black + "\u2503" + blue+"\u2503"+green+"\u2503"+red+"\u2503" + green + black + "\u2503";
private HashMap<Integer, String> cards;
......@@ -98,12 +97,12 @@ public class Cards {
cards.put(282,G8);
cards.put(291,G9);
cards.put(292,G9);
cards.put(2101,GRotate);
cards.put(2102,GRotate);
cards.put(2111,GSkip);
cards.put(2112,GSkip);
cards.put(2121,GPlus2);
cards.put(2122,GPlus2);
cards.put(2101,Grotate);
cards.put(2102,Grotate);
cards.put(2111,Gskip);
cards.put(2112,Gskip);
cards.put(2121,Gplus2);
cards.put(2122,Gplus2);
cards.put(301,B0);
cards.put(311,B1);
......@@ -124,12 +123,12 @@ public class Cards {
cards.put(382,B8);
cards.put(391,B9);
cards.put(392,B9);
cards.put(3101,BRotate);
cards.put(3102,BRotate);
cards.put(3111,BSkip);
cards.put(3112,BSkip);
cards.put(3121,BPlus2);
cards.put(3122,BPlus2);
cards.put(3101,Brotate);
cards.put(3102,Brotate);
cards.put(3111,Bskip);
cards.put(3112,Bskip);
cards.put(3121,Bplus2);
cards.put(3122,Bplus2);
cards.put(401,Y0);
cards.put(411,Y1);
......@@ -150,12 +149,12 @@ public class Cards {
cards.put(482,Y8);
cards.put(491,Y9);
cards.put(492,Y9);
cards.put(4101,YRotate);
cards.put(4102,YRotate);
cards.put(4111,YSkip);
cards.put(4112,YSkip);
cards.put(4121,YPlus2);
cards.put(4122,YPlus2);
cards.put(4101,Yrotate);
cards.put(4102,Yrotate);
cards.put(4111,Yskip);
cards.put(4112,Yskip);
cards.put(4121,Yplus2);
cards.put(4122,Yplus2);
cards.put(501,R0);
cards.put(511,R1);
......@@ -176,17 +175,17 @@ public class Cards {
cards.put(582,R8);
cards.put(591,R9);
cards.put(592,R9);
cards.put(5101,RRotate);
cards.put(5102,RRotate);
cards.put(5111,RSkip);
cards.put(5112,RSkip);
cards.put(5121,RPlus2);
cards.put(5122,RPlus2);
cards.put(5101,Rrotate);
cards.put(5102,Rrotate);
cards.put(5111,Rskip);
cards.put(5112,Rskip);
cards.put(5121,Rplus2);
cards.put(5122,Rplus2);
}
public HashMap getCardList(){
return cards;
}
public void addCard(Integer key, String value) {
cards.put(key, value);
}
......@@ -198,4 +197,7 @@ public class Cards {
public String getCard(Integer key) {
return cards.get(key);
}
public void printACard(Integer key){
System.out.println(getCard(key));
}
}
public class Main {
// public static final String ANSI_RESET = "\u001B[0m";
// public static final String black = "\u001B[30m";
// public static final String red= "\u001B[31m";
// public static final String green = "\u001B[32m";
public static final String yellow = "\u001B[33m";
// public static final String blue= "\u001B[34m";
// public static final String purple= "\u001B[35m";
// public static final String cyan = "\u001B[36m";
// public static final String white = "\u001B[37m";
public static void main(String[] args) {
Cards cards=new Cards();
//System.out.println("\u23B8 \u23B9");
cards.printHand();
System.out.println("|");
Cards cards = new Cards();
Repository repository = new Repository();
repository.addCard(431);
repository.addCard(521);
repository.addCard(112);
repository.addCard(121);
repository.addCard(461);
repository.addCard(361);
repository.addCard(272);
repository.addCard(2101);
repository.addCard(401);
repository.addCard(2111);
repository.addCard(2121);
repository.print();
}
......
import java.util.ArrayList;
import java.util.HashMap;
public class Repository {
public static final String black = "\u001B[30m";
public static final String red = "\u001B[31m";
public static final String green = "\u001B[32m";
public static final String yellow = "\u001B[33m";
public static final String blue = "\u001B[34m";
private ArrayList<String> repository;
private Cards cards;
public Repository(){
cards=new Cards();
//cards.addCard(R0,);
public Repository() {
repository = new ArrayList<>();
cards = new Cards();
}
public void addCard(Integer key) {
repository.add(cards.getCard(key));
}
public String getCard(int key) {
return cards.getCard(key);
}
public String top = "\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513" +
"\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513";
public String middle = "\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503";
public String down = "\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B" +
"\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B";
public void removeCard(String card) {
repository.remove(card);
}
public String getColor(String card){
if(card.contains("\u001B[30m"))
return black;
if(card.contains("\u001B[33m"))
return yellow;
if(card.contains("\u001B[31m"))
return red;
if(card.contains("\u001B[32m"))
return green;
if(card.contains("\u001B[34m"))
return blue;
else
return black;
}
public void print() {
for (String card : repository)
System.out.print(getColor(card)+"\u250F\u2501\u2501\u2501\u2513");
System.out.println();
for (String card : repository)
System.out.print(card);
System.out.println();
for (String card : repository)
System.out.print(getColor(card) +"\u2517\u2501\u2501\u2501\u251B");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment