package org.example.demo.praktikum1.aufgabe3;

import java.util.Random;

import jakarta.ejb.Stateful;

@Stateful
public class GuessingGame implements GuessingGameRemote {
    private int num;

    public void init() {
        var rng = new Random();
        num = 1 + rng.nextInt(0, 100);
    }

    public GuessResult testGuess(int guess) {
        if (guess < num) {
            return GuessResult.TooSmall;
        }
        if (guess > num) {
            return GuessResult.TooBig;
        }
        return GuessResult.Success;
    }
}
