Project

Guess the Animal (Java)

Challenging
142 completions
~ 43 hours
4.1

You will learn tree data structure, how to search it, and traverse all its nodes. You will also learn how to use this structure to store a knowledge base and how to store it using JSON format.

Provided by

JetBrains Academy JetBrains Academy

About

Artificial intelligence is not just a smart system: it's a smart system capable of self-learning. In this project, you will create a simple interactive game where the computer will try to guess the animal that the person has in mind with the help of yes or no questions. During the game, the computer will extend its knowledge base by learning new facts about animals and using this information in the next game. You will practice concepts frequently tested in technical interviews at top tech companies.

Training project icon

Training project

This project allows you to practice and strengthen your coding skills, helping you get ready for more advanced tasks ahead.

What you'll learn

Once you choose a project, we'll provide you with a study plan that includes all the necessary topics from your course to get it built. Here’s what awaits you:
Write a program that asks the user to enter an animal, defines the correct article, and asks a question based on the animal. The program should validate the user's answer and ask again if the answer is not clear.
The program should ask for the names of two animals and a fact that can help tell one animal from another. Based on the entered statement, the program prints facts about the animals.
Time to play! The program prompts the user to think of an animal and tries to guess it. If it fails, the program asks for the user's help. The new knowledge is stored in a binary tree and kept in memory for the current game session.
Our program learns but instantly forgets everything as soon as we finish the work. Let's implement saving information from the knowledge tree to the hard drive of the computer. We will use the JSON format to store the accumulated knowledge.
Our program knows all sorts of cool facts now. How many animals does it know? How many questions will it ask before making a guess? What does it know about each animal? In this stage, your program will finally get a menu and be able to give you this information.
There are over 7000 languages in the world. Let's make our game multilingual! We will add localization for Esperanto, an artificial language that does not belong to any country but is fairly popular. You can also add your native language or any language of your choice.

Reviews

Ekaterina Farygina avatar
Ekaterina Farygina
2 years ago
I've learned about graphs, trees, how to traverse them. I also learned a lot about working with property files and internationalisation of a program
Dmitry Golovkov avatar
Dmitry Golovkov
2 years ago
I practiced with serialization/deserialization, regular expressions, project organization, localization, connecting and using libraries (unfortunately, I had to give up the last one, because Gradle configuration files were crashing after synchronization with HyperSkill).
João Fekete avatar
João Fekete
2 years ago
I have learnt a lot about how regex and language options work on Java.

4.1

Learners who completed this project within the Java Desktop Application Developer course rated it as follows:
Usefulness
4.4
Fun
4.0
Clarity
3.7