Advertisement
avillapando381

Lego NXT Rock Paper Scissor Code

Aug 3rd, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 18.94 KB | None | 0 0
  1. import lejos.nxt.Button;
  2. import lejos.nxt.LCD;
  3. import lejos.nxt.Motor;
  4. import lejos.util.Delay;
  5. import java.util.*;
  6. import java.lang.Math;
  7. import lejos.nxt.Sound;
  8.  
  9.  
  10. public class Robotic {
  11.     public static boolean keepgoing = true;
  12.     public static int turns = 0;
  13.     public static int rockScore = 0;
  14.     public static int paperScore= 0;
  15.     public static int scissorScore = 0;
  16.     public static int win = 0;
  17.     public static int lose = 0;
  18.     public static Boolean playedRock1 = false;
  19.     public static Boolean playedRock2 = false;
  20.     public static Boolean playedRock3 = false;
  21.     public static Boolean playedScissors1 = false;
  22.     public static Boolean playedScissors2 = false;
  23.     public static Boolean playedScissors3 = false;
  24.     public static Boolean playedPaper1 = false;
  25.     public static Boolean playedPaper2 = false;
  26.     public static Boolean playedPaper3 = false;
  27.     public static Boolean result = false;
  28.    
  29. //Here is where you can change the weight of each strategy.I suggest increasing the weight of strategies involving paper, but that's just me.
  30.  
  31.     public static int strategy1 = 10;
  32.     public static int strategy2 = 10;
  33.     public static int strategy3 = 10;
  34.     public static int strategy4 = 10;
  35.     public static int strategy5 = 10;
  36.     public static int strategy6 = 10;
  37.     public static int strategy7 = 10;
  38.     public static int strategy8 = 10;
  39.     public static int strategy9 = 10;
  40.     public static int strategy10 = 10;
  41.     public static int strategy11 = 10;
  42.     public static int strategy12 = 10;
  43.     public static int strategy13 = 10;
  44.     public static int strategy14 = 10;
  45.     public static int strategy15 = 10;
  46.     public static int strategy16 = 10;
  47.     public static int strategy17 = 10;
  48.     public static int strategy18 = 10;
  49.     public static int strategy19 = 10;
  50.     public static int strategy20 = 10;
  51.     public static int strategy21 = 10;
  52.     public static int strategy22 = 10;
  53.     public static int strategy23 = 10;
  54.     public static int strategy24 = 10;
  55.     public static int strategy25 = 10;
  56.     public static int strategy26 = 10;
  57.     public static int strategy27 = 10;
  58.     public static int poopstall = 0;
  59.  
  60.     public static int[] scores = new int[300];
  61.    
  62.     public static Random rand = new Random();
  63.    
  64.     public static void main(String[] args) throws Exception {
  65.    
  66.          // Introduction
  67.  
  68.       LCD.drawString("ROCK PAPER SCISSORS", 0, 0);
  69.       LCD.drawString("I LOSE, PUSH LEFT", 0, 1);
  70.       LCD.drawString("I WIN, PUSH RIGHT", 0, 2);
  71.       LCD.drawString("WHEN YOU'RE READY", 0, 3);
  72.       LCD.drawString("PRESS ANYTHING ON SHOOT!", 0, 4);
  73.       Button.waitForAnyPress();
  74.       LCD.clear();
  75.  
  76.       while (keepgoing){
  77.           Play();
  78.         }
  79.      
  80.       LCD.clear();
  81.      
  82.       if (win>lose){
  83.           Sound.beepSequenceUp();
  84.           LCD.drawString("Hahaha I win!", 0, 1);
  85.           LCD.drawString("Hahaha I win!", 0, 2);
  86.           LCD.drawString("Hahaha I win!", 0, 3);
  87.           LCD.drawString("Hahaha I win!", 0, 4);
  88.           LCD.drawString("Hahaha I win!", 0, 5);
  89.           Button.waitForAnyPress();
  90.       }
  91.       else{
  92.           Sound.beepSequence();
  93.           LCD.drawString("Okay you win >:(", 0, 1);
  94.           LCD.drawString("Okay you win >:(", 0, 2);
  95.           LCD.drawString("Okay you win >:(", 0, 3);
  96.           LCD.drawString("Okay you win >:(", 0, 4);
  97.           LCD.drawString("Okay you win >:(", 0, 5);
  98.           Button.waitForAnyPress();
  99.       }
  100.          
  101.      
  102.     }
  103.      
  104.     //  }
  105.    
  106.    
  107.         public static void Play(){
  108.            
  109.             // Choose a random set pf 3 moves
  110.            
  111.             int randomthrow = pickPlay();
  112.            
  113.             if (randomthrow == 1){
  114.                 Rock();
  115.                 Rock();
  116.                 Rock();
  117.             }
  118.             else if (randomthrow == 2){
  119.                 Rock();
  120.                 Rock();
  121.                 Paper();
  122.             }
  123.             else if (randomthrow == 3){
  124.                 Rock();
  125.                 Rock();
  126.                 Scissors();
  127.             }
  128.             else if (randomthrow == 4){
  129.                 Rock();
  130.                 Paper();
  131.                 Rock();
  132.             }
  133.             else if (randomthrow == 5){
  134.                 Rock();
  135.                 Paper();
  136.                 Paper();
  137.             }
  138.             else if (randomthrow == 6){
  139.                 Rock();
  140.                 Paper();
  141.                 Scissors();
  142.             }
  143.             else if (randomthrow == 7){
  144.                 Rock();
  145.                 Scissors();
  146.                 Rock();
  147.             }
  148.             else if (randomthrow == 8){
  149.                 Rock();
  150.                 Scissors();
  151.                 Paper();
  152.             }
  153.             else if (randomthrow == 9){
  154.                 Rock();
  155.                 Scissors();
  156.                 Scissors();
  157.             }
  158.             else if (randomthrow == 10){
  159.                 Paper();
  160.                 Rock();
  161.                 Rock();
  162.             }
  163.             else if (randomthrow == 11){
  164.                 Paper();
  165.                 Rock();
  166.                 Paper();
  167.             }
  168.             else if (randomthrow == 12){
  169.                 Paper();
  170.                 Rock();
  171.                 Scissors();
  172.             }
  173.             else if (randomthrow == 13){
  174.                 Paper();
  175.                 Paper();
  176.                 Rock();
  177.             }
  178.             else if (randomthrow == 14){
  179.                 Paper();
  180.                 Paper();
  181.                 Paper();
  182.             }
  183.             else if (randomthrow == 15){
  184.                 Paper();
  185.                 Paper();
  186.                 Scissors();
  187.             }
  188.             else if (randomthrow == 16){
  189.                 Paper();
  190.                 Scissors();
  191.                 Rock();
  192.             }
  193.             else if (randomthrow == 17){
  194.                 Paper();
  195.                 Scissors();
  196.                 Paper();
  197.             }
  198.             else if (randomthrow == 18){
  199.                 Paper();
  200.                 Scissors();
  201.                 Scissors();
  202.             }
  203.             else if (randomthrow == 19){
  204.                 Scissors();
  205.                 Rock();
  206.                 Rock();
  207.             }
  208.             else if (randomthrow == 20){
  209.                 Scissors();
  210.                 Rock();
  211.                 Paper();
  212.             }
  213.             else if (randomthrow == 21){
  214.                 Scissors();
  215.                 Rock();
  216.                 Scissors();
  217.             }
  218.             else if (randomthrow == 22){
  219.                 Scissors();
  220.                 Paper();
  221.                 Rock();
  222.             }
  223.             else if (randomthrow == 23){
  224.                 Scissors();
  225.                 Paper();
  226.                 Paper();
  227.             }
  228.             else if (randomthrow == 24){
  229.                 Scissors();
  230.                 Paper();
  231.                 Scissors();
  232.             }
  233.             else if (randomthrow == 25){
  234.                 Scissors();
  235.                 Scissors();
  236.                 Rock();
  237.             }
  238.             else if (randomthrow == 26){
  239.                 Scissors();
  240.                 Scissors();
  241.                 Paper();;
  242.             }
  243.             else if (randomthrow == 27){
  244.                 Scissors();
  245.                 Scissors();
  246.                 Scissors();
  247.             }
  248.            
  249.         }
  250.    
  251.         public static int pickPlay(){
  252.  
  253.             //Choose a random number for a random move
  254.  
  255.             updateScorecard();
  256.             int randomthrow = rand.nextInt(100);
  257.             int cantthinkofavariable = scores[randomthrow];
  258.             return cantthinkofavariable;
  259.         }
  260.        
  261.        
  262.         public static int sumUp(){
  263.        
  264.                 // Add up all occurences of strategies together
  265.  
  266.           int testnum = strategy1 + strategy2 + strategy3 + strategy4 + strategy5 + strategy6 + strategy7 + strategy8 + strategy9 + strategy10 +
  267.  
  268. strategy11+ strategy12 +
  269.  
  270. strategy13+strategy14+strategy15+strategy16+strategy17+strategy18+strategy19+strategy20+strategy21+strategy22+strategy23+strategy24+strategy25+strategy26
  271.  
  272. +strategy27;
  273.           return testnum;
  274.         }
  275.  
  276.         public static void updateScorecard(){
  277.  
  278.         // This is the intelligent part. This ends up with an array proportionally filled with the corresponding number for each strategy
  279.         // The occurence of each strategy dictates the amount of times its number will appear in the array. Then the array is used to choose the
  280.         // Set of 3 moves
  281.            
  282.             int total = sumUp();
  283.            
  284.             int a = (int)Math.round(strategy1 * 100.0/total);
  285.             int b = (int)Math.round(strategy2 * 100.0/total);
  286.             int c = (int)Math.round(strategy3 * 100.0/total);
  287.             int d = (int)Math.round(strategy4 * 100.0/total);
  288.             int e = (int)Math.round(strategy5 * 100.0/total);
  289.             int f = (int)Math.round(strategy6 * 100.0/total);
  290.             int g = (int)Math.round(strategy7 * 100.0/total);
  291.             int h = (int)Math.round(strategy8 * 100.0/total);
  292.             int i = (int)Math.round(strategy9 * 100.0/total);
  293.             int j = (int)Math.round(strategy10 * 100.0/total);
  294.             int k = (int)Math.round(strategy11 * 100.0/total);
  295.             int l = (int)Math.round(strategy12* 100.0/total);
  296.             int m = (int)Math.round(strategy13 * 100.0/total);
  297.             int n = (int)Math.round(strategy14 * 100.0/total);
  298.             int o = (int)Math.round(strategy15 * 100.0/total);
  299.             int p = (int)Math.round(strategy16 * 100.0/total);
  300.             int q = (int)Math.round(strategy17 * 100.0/total);
  301.             int r = (int)Math.round(strategy18 * 100.0/total);
  302.             int s = (int)Math.round(strategy19 * 100.0/total);
  303.             int t = (int)Math.round(strategy20 * 100.0/total);
  304.             int u = (int)Math.round(strategy21 * 100.0/total);
  305.             int v = (int)Math.round(strategy22 * 100.0/total);
  306.             int w = (int)Math.round(strategy23 * 100.0/total);
  307.             int x = (int)Math.round(strategy24 * 100.0/total);
  308.             int y = (int)Math.round(strategy25 * 100.0/total);
  309.             int z = (int)Math.round(strategy26 * 100.0/total);
  310.             int ab = (int)Math.round(strategy27 * 100.0/total);
  311.                    
  312.             for(poopstall = 0 ; poopstall <= a  ; poopstall++){
  313.                 scores[poopstall] = 1;
  314.             }
  315.             for(poopstall = a + 1 ; poopstall <= a + b  ; poopstall++){
  316.                 scores[poopstall] = 2;
  317.             }
  318.             for(poopstall = a+ b + 1 ; poopstall <=a+ b + c  ; poopstall++){
  319.                 scores[poopstall] = 3;
  320.             }
  321.             for(poopstall =a+b+  c + 1 ; poopstall <=a+b+ c + d  ; poopstall++){
  322.                 scores[poopstall] = 4;
  323.             }
  324.             for(poopstall =a+b+c+ d + 1 ; poopstall <=a+b+c+ d + e  ; poopstall++){
  325.                 scores[poopstall] = 5;
  326.             }
  327.             for(poopstall =a+b+c+d+ e + 1 ; poopstall <=a+b+c+d+ e + f  ; poopstall++){
  328.                 scores[poopstall] = 6;
  329.             }
  330.             for(poopstall =a+b+c+d+ e + f + 1 ; poopstall <=a+b+c+d+ e + f + g  ; poopstall++){
  331.                 scores[poopstall] = 7;
  332.             }
  333.             for(poopstall =a+b+c+d+ e + f+g + 1 ; poopstall <=a+b+c+d+ e + f+ g + h  ; poopstall++){
  334.                 scores[poopstall] = 8;
  335.             }
  336.             for(poopstall =a+b+c+d+ e + f+g+ h + 1 ; poopstall <=a+b+c+d+ e + f+g+ h + i  ; poopstall++){
  337.                 scores[poopstall] = 9;
  338.             }
  339.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+  i + j  ; poopstall++){
  340.                 scores[poopstall] = 10;
  341.             }
  342.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k  ; poopstall++){
  343.                 scores[poopstall] = 11;
  344.             }
  345.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j +k + l  ; poopstall++){
  346.                 scores[poopstall] = 12;
  347.             }
  348.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l + m  ; poopstall++){
  349.                 scores[poopstall] = 13;
  350.             }
  351.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l +m + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l + m + n  ; poopstall+
  352.  
  353. +){
  354.                 scores[poopstall] = 14;
  355.             }
  356.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l +m + n + o  ;
  357.  
  358. poopstall++){
  359.                 scores[poopstall] = 15;
  360.             }
  361.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p  ;
  362.  
  363. poopstall++){
  364.                 scores[poopstall] = 16;
  365.             }
  366.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o +
  367.  
  368. p + q  ; poopstall++){
  369.                 scores[poopstall] = 17;
  370.             }
  371.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n +
  372.  
  373. o + p + q + r  ; poopstall++){
  374.                 scores[poopstall] = 18;
  375.             }
  376.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n
  377.  
  378. + o + p +q + r + s  ; poopstall++){
  379.                 scores[poopstall] = 19;
  380.             }
  381.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k + l
  382.  
  383. +m +n + o + p +q + r + s + t  ; poopstall++){
  384.                 scores[poopstall] = 20;
  385.             }
  386.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i + j + k +
  387.  
  388. l +m +n + o + p +q + r + s + t + u  ; poopstall++){
  389.                 scores[poopstall] = 21;
  390.             }
  391.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + 1 ; poopstall <= a+b+c+d+ e + f+g+ h+ i + j
  392.  
  393. + k + l +m +n + o + p +q + r + s + t +u + v  ; poopstall++){
  394.                 scores[poopstall] = 22;
  395.             }
  396.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v + 1 ; poopstall <=a+b+c+d+ e + f+g+ h+ i
  397.  
  398. + j + k + l +m +n + o + p +q + r + s + t + u + v + v + w  ; poopstall++){
  399.                 scores[poopstall] = 23;
  400.             }
  401.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w + 1 ; poopstall <=a+b+c+d+ e + f+g+
  402.  
  403. h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v + w + x  ; poopstall++){
  404.                 scores[poopstall] = 24;
  405.             }
  406.             for(poopstall = a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w +x + 1 ; poopstall <=a+b+c+d+ e + f
  407.  
  408. +g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w + x + y  ; poopstall++){
  409.                 scores[poopstall] = 25;
  410.             }
  411.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w +x + y + 1 ; poopstall <=a+b+c+d+ e +
  412.  
  413. f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w +x + y + z  ; poopstall++){
  414.                 scores[poopstall] = 26;
  415.             }
  416.             for(poopstall =a+b+c+d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w +x + y +  z + 1 ; poopstall <=a+b+c
  417.  
  418. +d+ e + f+g+ h+ i + j + k + l +m +n + o + p +q + r + s + t + u + v +  w +x + y +  z + ab  ; poopstall++){
  419.                 scores[poopstall] = 27;
  420.             }
  421.         }
  422.        
  423.        
  424.  
  425.             public static void whoWon(){
  426. // This updates the screen, telling who won each turn.
  427.  
  428.             result = false;
  429.             LCD.drawString("DID I WIN?", 0, 0);
  430.         LCD.drawString("ESCAPE TO QUIT", 0, 1);
  431.             LCD.drawString("LEFT IF I WON" , 0, 2);
  432.             LCD.drawString("RIGHT IF I LOST", 0, 3);
  433.         LCD.drawString("Current Score is", 0, 4);
  434.             LCD.drawInt(win,0,5);
  435.             LCD.drawString("wins", 6, 5);
  436.             LCD.drawInt(lose,0,6);
  437.             LCD.drawString("losses", 6, 6);
  438.             Button.waitForAnyPress();
  439.             if (Button.LEFT.isDown()) {
  440.                 result = true;
  441.                 win += 1;
  442.             } else if (Button.RIGHT.isDown()) {
  443.                result = false;
  444.                lose +=1;
  445.             } else if (Button.ESCAPE.isDown()) {
  446.                 keepgoing = false;
  447.             }
  448.             Delay.msDelay(500);
  449.  
  450.         }
  451.        
  452.  
  453.         public static void Rock(){
  454.             // Moves the arm
  455.            
  456.             ++turns;
  457.            
  458.             Sound.playTone(1050,400,100);
  459.             Delay.msDelay(700);
  460.             Sound.playTone(1050,400,100);
  461.             Delay.msDelay(700);
  462.             Sound.playTone(1050,400,100);
  463.             Delay.msDelay(700);
  464.             Sound.playTone(1375,400,100);
  465.                Motor.A.setSpeed(10000);
  466.                Motor.B.setSpeed(10000);
  467.                Motor.C.setSpeed(10000);
  468.                Motor.A.rotate(10,true);
  469.                Motor.C.rotate(10,true);
  470.                Motor.B.rotate(10,true);
  471.                whoWon();
  472.                Motor.A.rotateTo(0,true);
  473.                Motor.C.rotateTo(0,true);
  474.                Motor.B.rotateTo(0,true);
  475.            
  476.            
  477.            
  478.            if(turns%3 == 1 && result == true)
  479.                 playedRock1 = true;
  480.             else if(turns%3 == 1 && result == false)
  481.                 playedScissors1 = true;
  482.             else if(turns%3 == 2 && result == true)
  483.                 playedRock2 = true;
  484.             else if(turns%3 == 2 && result == false)
  485.                 playedScissors2 = true;
  486.             else if(turns%3 == 0  && result == true)
  487.                 playedRock3 = true;
  488.             else if(turns%3 == 0 && result == false)
  489.                 playedScissors3 = true;
  490.            
  491.            
  492.            
  493.            
  494.             gambit();
  495.            
  496.         }
  497.        
  498.     public static void Paper(){
  499.         //Moves the arm
  500.            
  501.             ++turns;
  502.            
  503.             Sound.playTone(1050,400,100);
  504.             Delay.msDelay(700);
  505.             Sound.playTone(1050,400,100);
  506.             Delay.msDelay(700);
  507.             Sound.playTone(1050,400,100);
  508.             Delay.msDelay(700);
  509.             Sound.playTone(1375,400,100);
  510.                Motor.A.setSpeed(10000);
  511.                Motor.B.setSpeed(10000);
  512.                Motor.C.setSpeed(10000);
  513.                Motor.A.rotate(110,true);
  514.                Motor.C.rotate(90,true);
  515.                Motor.B.rotate(110,true);
  516.                whoWon();
  517.                Motor.A.rotateTo(0,true);
  518.                Motor.C.rotateTo(0,true);
  519.                Motor.B.rotateTo(0,true);
  520.  
  521.  
  522.                
  523.                if(turns%3 == 1 && result == true)
  524.                     playedPaper1 = true;
  525.                 else if(turns%3 == 1 && result == false)
  526.                     playedRock1 = true;
  527.                 else if(turns%3 == 2 && result == true)
  528.                     playedPaper2 = true;
  529.                 else if(turns%3 == 2 && result == false)
  530.                     playedRock2 = true;
  531.                 else if(turns%3 == 0  && result == true)
  532.                     playedPaper3 = true;
  533.                 else if(turns%3 == 0 && result == false)
  534.                     playedRock3 = true;
  535.                
  536.              
  537.                
  538.             gambit();
  539.            
  540.         }
  541.    
  542.     public static void Scissors(){
  543.  
  544.             // moves the arm
  545.        
  546.         ++turns;
  547.         Sound.playTone(1050,400,100);
  548.         Delay.msDelay(700);
  549.         Sound.playTone(1050,400,100);
  550.         Delay.msDelay(700);
  551.         Sound.playTone(1050,400,100);
  552.         Delay.msDelay(700);
  553.         Sound.playTone(1375,400,100);
  554.        Motor.C.setSpeed(10000);
  555.        Motor.C.rotate(110,true);
  556.        whoWon();
  557.        Motor.C.rotateTo(0,true);
  558.  
  559.        
  560.      
  561.        
  562.        if(turns%3 == 1 && result == true)
  563.             playedScissors1 = true;
  564.         else if(turns%3 == 1 && result == false)
  565.             playedPaper1 = true;
  566.         else if(turns%3 == 2 && result == true)
  567.             playedScissors2 = true;
  568.         else if(turns%3 == 2 && result == false)
  569.             playedPaper2 = true;
  570.         else if(turns%3 == 0  && result == true)
  571.             playedScissors3 = true;
  572.         else if(turns%3 == 0 && result == false)
  573.             playedPaper3 = true;
  574.        
  575.  
  576.        
  577.         gambit();
  578.     }
  579.        
  580.        
  581.        
  582.         public static void gambit(){
  583.        
  584.             // This increments the occurence of each strategy every 3 moves
  585.  
  586.             if (turns%3 == 0){
  587.                
  588.                 playedRock1 = false;
  589.                 playedRock2 = false;
  590.                 playedRock3 = false;
  591.                 playedScissors1 = false;
  592.                 playedScissors2 = false;
  593.                 playedScissors3 = false;
  594.                 playedPaper1 = false;
  595.                 playedPaper2 = false;
  596.                 playedPaper3 = false;
  597.             }
  598.  
  599.             if (playedRock1 && playedRock2 && playedRock3)
  600.                 strategy1 +=1;
  601.             else if (playedRock1 && playedRock2 && playedPaper3)
  602.                 strategy2 +=1;
  603.             else if (playedRock1 && playedRock2 && playedScissors3)
  604.                 strategy3 +=1;
  605.             else if(playedRock1 && playedPaper2 && playedRock3)
  606.                 strategy4 += 1;
  607.             else if(playedRock1 && playedPaper2 && playedPaper3)
  608.                 strategy5 +=1;
  609.             else if(playedRock1 && playedPaper2 && playedScissors3)
  610.                 strategy6 +=1;
  611.             else if(playedRock1 && playedScissors2 && playedRock3)
  612.                 strategy7 +=1;
  613.             else if(playedRock1 && playedScissors2 && playedPaper3)
  614.                 strategy8 +=1;
  615.             else if(playedRock1 && playedScissors2 && playedScissors3)
  616.                 strategy9 +=1;
  617.             else if(playedPaper1 && playedRock2 && playedRock3)
  618.                 strategy10 +=1;
  619.             else if(playedPaper1 && playedRock2 && playedPaper3)
  620.                 strategy11 +=1;
  621.             else if(playedPaper1 && playedRock2 && playedScissors3)
  622.                 strategy12 +=1;
  623.             else if(playedPaper1 && playedPaper2 && playedRock3)
  624.                 strategy13 +=1;
  625.             else if(playedPaper1 && playedPaper2 && playedPaper3)
  626.                 strategy14 +=1;
  627.             else if(playedPaper1 && playedPaper2 && playedScissors3)
  628.                 strategy15 +=1;
  629.             else if(playedPaper1 && playedScissors2 && playedRock3)
  630.                 strategy16 +=1;
  631.             else if(playedPaper1 && playedScissors2 && playedPaper3)
  632.                 strategy17 +=1;
  633.             else if(playedPaper1 && playedScissors2 && playedScissors3)
  634.                 strategy18 +=1;
  635.             else if(playedScissors1 && playedRock2 && playedRock3)
  636.                 strategy19 +=1;
  637.             else if(playedScissors1 && playedRock2 && playedPaper3)
  638.                 strategy20 +=1;
  639.             else if(playedScissors1 && playedRock2 && playedScissors3)
  640.                 strategy21 +=1;
  641.             else if(playedScissors1 && playedPaper2 && playedRock3)
  642.                 strategy22 +=1;
  643.             else if(playedScissors1 && playedPaper2 && playedPaper3)
  644.                 strategy23 +=1;
  645.             else if(playedScissors1 && playedPaper2 && playedScissors3)
  646.                 strategy24 +=1;
  647.             else if(playedScissors1 && playedScissors2 && playedRock3)
  648.                 strategy25 +=1;
  649.             else if(playedScissors1 && playedScissors2 && playedPaper3)
  650.                 strategy26 +=1;
  651.             else if(playedScissors1 && playedScissors2 && playedScissors3)
  652.                 strategy27 +=1;
  653.         }
  654.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement