Skip to main content

Featured

Best AI tools for students

Top 3 AI tools for Student  The biggest problem facing students in an information-rich environment is not access, but effective learning. A new generation of Artificial Intelligence (AI) tools is achieving previously unheard-of levels of efficiency, even while tools like interactive simulations and 3D models (like PhET or BioDigital) have made difficult subjects visual. AI is entering the classroom to help with anything from creating personalized study materials to giving prompt, focused feedback on tasks. AI is a co-pilot for the student trip, freeing up cognitive space for more in-depth critical thinking and creative work. We are getting past the basic calculator example. Here are some key AI resources that all students should be aware of and use in order to thrive in the contemporary world. 1. Human Bio Digital Explore the Inner Workings of the Human Body in 3D! Have you ever wished you could peel back the layers and truly see how your body—or a specific medical condition—actual...

Rock, Paper, Scissor Game in Java

We can make a simple rock, paper, scissor game in java. Heres, the code:


 import java.util.Scanner;

import javax.lang.model.util.ElementScanner14;

import java.util.Random;

public class App {

    public static void main(String[] args) throws Exception {

        Scanner scan = new Scanner(System.in);

        Random rand = new Random();


        int rand_1 = rand.nextInt(3);


        System.out.println("\nRock, Paper, Scissior Game");

        int trial = 1;

        int player_score = 0;

        int computer_score = 0;


        while (trial<=5) {

            System.out.println("\n0) Rock");

            System.out.print("1) Paper");

            System.out.print("\n2) Scissior");


            System.out.print("\nEnter the choice number: ");

            int choice = scan.nextInt();

            

            // System.out.println(rand_1);


            if (choice == rand_1) {

                System.out.println("Player and Computer Selected Same ");

                // System.out.println("Computer Choice: "+ rand_1);

            } else {


                switch (choice) {

                    case 0:

                        System.out.println("Computer choice: "+ rand_1);

                        if(rand_1<2){

                            if(0<rand_1){

                                System.out.println("Computer wins Match round "+ trial);

                                computer_score = computer_score+1;

                            }

                        }else{

                            System.out.println("Player wins Match round "+ trial);

                            player_score = player_score+1;

                        }

                        break;

                    case 1:

                        System.out.println("Computer choice: "+ rand_1);

                        if(0<rand_1){

                            if(1<rand_1){

                                System.out.println("Computer wins Match round "+ trial);

                                computer_score = computer_score+1;

                            }

                        }else{

                            System.out.println("Player wins Match round "+ trial);

                            player_score = player_score+1;

                        }

                        break;

                    case 2:

                        System.out.println("Computer choice: "+ rand_1);

                        if(rand_1<1){

                            if(rand_1<2){

                                System.out.println("Computer wins Match round "+ trial);

                                computer_score = computer_score+1;

                            }

                        }else{

                            System.out.println("Player wins Match round "+ trial);

                            player_score = player_score+1;

                        }

                        

                        break;

                    default:

                        System.out.println("Wrong input");

                        break;

                }   

            }

            trial = trial+1;

        }

        System.out.println("\nPlayer Score: "+ player_score);

        System.out.println("Computer Score: "+computer_score);

    

        if (player_score>computer_score) {

            int sp = player_score-computer_score;

            System.out.println("\nPlayer won the game by " + sp);

        } else if(computer_score>player_score) {

            int cp = computer_score-player_score;

            System.out.println("\nPlayer lose the game by "+cp);

        }else{

            System.out.println("\nNo one wins the game");

        }

    }


}


Comments

Popular Posts