only spam
  • 17 posts
  • Page 1 of 2
thaithai wrote:
now we discus this problem ,i solve first.
1 vs 1
for (int def=1;def<7;def++){
  for(int att=1;att<7;att++){
   if (def>=att) lose++;
    else win++;
   }
  }
System.out.println(win + " vs " + lose);
we have att=15 vs def=21 .we have 2 if loop 15+21=36=6*6 true
lionheart wrote:
??? what a head ache thai.

3 dice attack v 2 dice defence the attacker has the odds very slightly in his favour

if your talking about strategy in 1v1 its attack, attack, attack and hope you come out on top
thaithai wrote:
next 2 vs 1
public class test {
static int win=0; static int lose=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static void descend(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
}
}
}
public static void main(String[] args) {
for (int def=1;def<7;def++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){
descend(att1);
descend(att2);
if (def>=listAtt.get(0)) lose++;
else win++;
listAtt.clear();

}
}
}
System.out.println("att="+win + " vs " +"def="+ lose);
}
}
att=125 vs def=91
please repair if i wrong
thaithai wrote:
next 3 vs 1
public class test {
static int win=0; static int lose=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static void descend(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
}
}
}
public static void main(String[] args) {
for (int def=1;def<7;def++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){
for(int att3=1;att3<7;att3++){
descend(att1);
descend(att2);
descend(att3);
if (def>=listAtt.get(0)) lose++;
else win++;
listAtt.clear();
}
}
}
}
System.out.println("att="+win + " vs " +"def="+ lose);
}
}
att=855 vs def=441
thaithai wrote:
next 1 vs 2
public class test {
static int win=0; static int lose=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static List<Integer> listDef=new ArrayList<Integer>();
static void descendDef(int a){
if(listDef.size()==0) {
listDef.add(a);
}
else{
for(int i=0;i < listDef.size();i++){
if(a>=listDef.get(i)){
listDef.add(i,a);
break;
}
}
}
}
  static void descendAtt(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
}
}
}
public static void main(String[] args) {
for (int def1=1;def1<7;def1++){
for(int def2=1;def2<7;def2++){
for(int att1=1;att1<7;att1++){
descendDef(def1);
descendDef(def2);
if(listDef.get(0)>=att1) lose++;
else win++;
}
}
}
System.out.println("att="+win + " vs " +"def="+ lose);
att=15 vs def=201
please repair if i wrong
thaithai wrote:
public class test {
static int win=0; static int lose=0;static int draw=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static List<Integer> listDef=new ArrayList<Integer>();
static void descendDef(int a){
if(listDef.size()==0) {
listDef.add(a);
}
else{
for(int i=0;i < listDef.size();i++){
if(a>=listDef.get(i)){
listDef.add(i,a);
break;
}
}
}
}
  static void descendAtt(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
}
}
}
public static void main(String[] args) {
for (int def1=1;def1<7;def1++){
for(int def2=1;def2<7;def2++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){
int temp=0;
descendDef(def1);
descendDef(def2);
descendAtt(att1);
descendAtt(att2);
if(listDef.get(0)>=listAtt.get(0)) temp--;
else temp++;
if(listDef.get(1)>=listAtt.get(1)) temp--;
else temp++;
if (temp<0) lose++;
if (temp>0) win++;
else draw++;
}
}
}
}
System.out.println("att="+win + " vs def="+ lose +" vs draw="+draw );
}
}
att=178 vs def=1116 vs draw=1118
thaithai wrote:
public class test {
static int win=0; static int lose=0;static int draw=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static List<Integer> listDef=new ArrayList<Integer>();
static void descendDef(int a){
if(listDef.size()==0) {
listDef.add(a);
}
else{
for(int i=0;i < listDef.size();i++){
if(a>=listDef.get(i)){
listDef.add(i,a);
break;
}
}
}
}
  static void descendAtt(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
}
}
}
public static void main(String[] args) {
for (int def1=1;def1<7;def1++){
for(int def2=1;def2<7;def2++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){
for(int att3=1;att3<7;att3++){
int temp=0;
descendDef(def1);
descendDef(def2);
descendAtt(att1);
descendAtt(att2);
descendAtt(att3);
if(listDef.get(0)>=listAtt.get(0)) temp--;
else temp++;
if(listDef.get(1)>=listAtt.get(1)) temp--;
else temp++;
if (temp<0) lose++;
if (temp>0) win++;
else draw++;
}
}
}
}
}
System.out.println("att="+win + " vs def="+ lose +" vs draw="+draw );
}
}
att=1078 vs def=6696 vs draw=6698
thaithai wrote:
i have repair
3 vs 2
public class test {
static int win=0; static int lose=0;static int draw=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static List<Integer> listDef=new ArrayList<Integer>();
static void descendDef(int a){
if(listDef.size()==0) {
listDef.add(a);
}
else{
for(int i=0;i < listDef.size();i++){
if(a>=listDef.get(i)){
listDef.add(i,a);
break;
}
listDef.add(a);
}
}
}
  static void descendAtt(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
listAtt.add(a);
}
}
}
public static void main(String[] args) {
for (int def1=1;def1<7;def1++){
for(int def2=1;def2<7;def2++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){
for(int att3=1;att3<7;att3++){
int temp=0;
descendDef(def1);
descendDef(def2);
descendAtt(att1);
descendAtt(att2);
descendAtt(att3);
if(listDef.get(0)>=listAtt.get(0)) temp--;
else temp++;
if(listDef.get(1)>=listAtt.get(1)) temp--;
else temp++;
if (temp<0) lose++;
if (temp>0) win++;
else draw++;
listAtt.clear();
listDef.clear();
}
}
}
}
}
System.out.println("att="+win + " vs def="+ lose +" vs draw="+draw );}}
att=2890 vs def=2275 vs draw=4886
thaithai wrote:
i have repair
2 vs 2
public class test {
static int win=0; static int lose=0;static int draw=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static List<Integer> listDef=new ArrayList<Integer>();
static void descendDef(int a){
if(listDef.size()==0) {
listDef.add(a);
}
else{
for(int i=0;i < listDef.size();i++){
if(a>=listDef.get(i)){
listDef.add(i,a);
break;
}
listDef.add(a);
}
}
}
  static void descendAtt(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
listAtt.add(a);
}
}
}
public static void main(String[] args) {
for (int def1=1;def1<7;def1++){
for(int def2=1;def2<7;def2++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){

int temp=0;
descendDef(def1);
descendDef(def2);
descendAtt(att1);
descendAtt(att2);

if(listDef.get(0)>=listAtt.get(0)) temp--;
else temp++;
if(listDef.get(1)>=listAtt.get(1)) temp--;
else temp++;
if (temp<0) lose++;
if (temp>0) win++;
else draw++;
listAtt.clear();
listDef.clear();

}
}
}
}
System.out.println("att="+win + " vs def="+ lose +" vs draw="+draw );}}
att=295 vs def=581 vs draw=1001
4myGod wrote:
I am quite confused here thaithai... I don't know what this stuff means.
thaithai wrote:
i write a method to calculate defence and attack but i wrong something.i write by java.now i have new repair .i hope it true
4mygod u write a method too then check this.
3 attack 2

public class test {
static int win=0; static int lose=0;static int draw=0;
static List<Integer> listAtt=new ArrayList<Integer>();
static List<Integer> listDef=new ArrayList<Integer>();
static void descendDef(int a){
if(listDef.size()==0) {
listDef.add(a);
}
else{
for(int i=0;i < listDef.size();i++){
if(a>=listDef.get(i)){
listDef.add(i,a);
break;
}
}
if (a<listDef.get(listDef.size()-1)) listDef.add(a);
}
}
static void descendAtt(int a){
if(listAtt.size()==0) {
listAtt.add(a);
}
else{
for(int i=0;i < listAtt.size();i++){
if(a>=listAtt.get(i)){
listAtt.add(i,a);
break;
}
}
if (a<listAtt.get(listAtt.size()-1)) listAtt.add(a);
}
}
public static void main(String[] args) {
for (int def1=1;def1<7;def1++){
for(int def2=1;def2<7;def2++){
for(int att1=1;att1<7;att1++){
for(int att2=1;att2<7;att2++){
for(int att3=1;att3<7;att3++){
int temp=0;
descendDef(def1);
descendDef(def2);
descendAtt(att1);
descendAtt(att2);
descendAtt(att3);
if(listDef.get(0)>=listAtt.get(0)) temp--;
else temp++;
if(listDef.get(1)>=listAtt.get(1)) temp--;
else temp++;
if (temp<0) lose++;
if (temp>0) win++;
else draw++;
listAtt.clear();
listDef.clear();
}
}
}
}
}
System.out.println("att="+win + " vs def="+ lose +" vs draw="+draw );}}
att=2890 and def=2275 and draw=4886
sorry i am careless so i post so much.4mygod u can delete all but this post
FarangDemon wrote:
If you want to check quickly, P(win double) when you attack 3 vs 2 is higher than P(draw) or P(lose double)
barack_obama wrote:
Wait, so if the attacker has a higher chance of winning in 3v2, why do I never win when I have 3v2??? And anyway, how did you do that