Multiplayer 20 Questions is a Java-based implementation of the classic guessing game “20 Questions,” designed for multiple players over a network. One player hosts the server, and others connect as clients to play together in real time.
The game allows several players to join a shared session where one player thinks of a word, and others take turns asking yes/no questions to guess it within 20 questions. It demonstrates fundamental concepts in Java socket programming, client-server communication, and multiplayer game logic.
- mainServer.java — Starts the main server, listens for incoming connections, and manages game sessions.
- newClient.java — Connects a player to the server and provides the interface for asking questions and making guesses.
- gameLogic.java — Contains the core logic that tracks questions, answers, turns, and determines when the game ends.
- Java 17 or later
- A terminal or IDE
From inside the project folder, compile all Java files:
javac *.javajava mainServerjava newClient