gorillakelvin's Recent Forum Activity

  • public class test {
    	public static void main(String args[]) {
    
            //Number of the card which the user own
    		int card[];
    		card = new int[11];
    		card[1] = 0;
    		card[2] = 1;
    		card[3] = 0;
    		card[4] = 1;
    		card[5] = 0;
    		card[6] = 1;
    		card[7] = 0;
    		card[8] = 1;
    		card[9] = 0;
    		card[10] = 1;
    
            //array that save the card no.  which the user didn't own 
    		int count = 1;
    		int newCard[];
    		newCard = new int[11];
    
    		for (int i = 1; i < card.length; i++) {
    			if (card[i] == 0) {
    				newCard[count] = i;
    				count++;
    			}
    		}
    
            // drawing a random card from the arry which the user didn't own
    		int randomCard = 0;
    
    		do {
    			randomCard = (int)(Math.random() * (newCard.length));
    		} while ( newCard [ randomCard ] == 0);
    
    		// 1,3,5,7,9 is expected to be the result
            System.out.println("RandomCard from Above:" + newCard[randomCard]);
    
    	}
    }
    [/code:3lskg9ji]
    I don't know how to transfer the code above to Construct 2 format, would somebody could help me
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
gorillakelvin's avatar

gorillakelvin

Member since 7 Dec, 2017

None one is following gorillakelvin yet!

Trophy Case

  • 6-Year Club
  • Email Verified

Progress

7/44
How to earn trophies