Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.house.UTP;
- import java.util.ArrayList;
- import java.util.Random;
- public class Main {
- ArrayList<String> teste = new ArrayList<String>();
- public static void main(String[] args) {
- boolean bit;
- while (true) {
- // CRIANDO O VETOR HI
- ArrayList<Boolean> hi = new ArrayList<Boolean>();
- hi.add(true);
- hi.add(false);
- // CRIAÇÃO DO VETOR TEMPORÁRIO
- ArrayList<Boolean> temp = new ArrayList<Boolean>();
- // GERAÇÃO DE NÚMEROS ALEATÓRIOS
- Random random = new Random();
- bit = random.nextBoolean();
- // PROCESSAMENTO
- int cont = 0;
- if (hi.get(cont)) {
- // DEVE SER VERDADEIRO
- if (bit) {
- // CORRETO
- temp.add(bit);
- cont++;
- } else {
- // ERRADO
- if (bit == hi.get(0)) {
- temp.clear();
- temp.add(bit);
- cont = 1;
- } else {
- temp.clear();
- cont = 0;
- }
- }
- } else {
- // DEVE SER FALSO
- if (!(bit)) {
- // CORRETO
- temp.add(bit);
- cont++;
- } else {
- // ERRADO
- if (bit == hi.get(0)) {
- temp.clear();
- temp.add(bit);
- cont = 1;
- } else {
- temp.clear();
- cont = 0;
- }
- }
- }
- // ESVAZIA O VETOR E PRINTA
- if (temp.size() == 2) {
- System.out.println("Yeah");
- temp.clear();
- cont = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement