Skip to content
TheChatArchiveThe Chat Archive
Amazon Novaamazon-nova-experimental-chat-05-14· AmazonHugging Face LMArena Human Preference 140K

wrte me a script in jac language for a akinator game

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-7-sonnet-20250219’s answer.
  1. User

    wrte me a script in jac language for a akinator game

  2. Amazon Nova Assistant

    Certainly! Below is a script for an Akinator-like game using the Jac language. Jac is a language designed for building autonomous agents, and it's well-suited for interactive games like Akinator. In this script, the agent will ask yes-or-no questions to guess the character the player is thinking of.

    actor AkinatorGame {
    
      // State to keep track of questions and potential answers
      state {
        questions: ["Is it a human?", "Is it a male?", "Is it a fictional character?", "Is it from a movie?", "Was it released after 2000?"]
        potential_answers: ["Harry Potter", "Batman", "Iron Man", "Superman", "Wonder Woman", "Hermione Granger", "Captain America", "Spider-Man","Darth Vader","Luke Skywalker"]
        current_question_index: 0
        possible_characters: potential_answers // Initialise with all potential answers
      }
       
      // Capability to start the game
      capability start_game {
        invoke init;
      }
      
      // Initialise the game
      capability init {
        // Greet the player and start the first question
        publish "Welcome to Akinator! Think of a character, and I will try to guess it.";
        publish "Let's begin!";
        ask_question();
      }
      
      // Ask the next question
      capability ask_question {
        if (state.current_question_index >= len(state.questions)) {
          publish "I've run out of questions! Let me take a guess...";
          make_guess();
          return;
        }
    	
        // Ask the current question
        publish state.questions[state.current_question_index];
        await_answer();
      }
      
      // Await the player's answer
      capability await_answer {
        // Wait for the player's response
        subscribe "answer" as response;
        if (response == "yes") {
          filter_characters(true);
        } else if (response == "no") {
          filter_characters(false);
        } else {
          publish "Please answer with 'yes' or 'no'.";
          await_answer();
          return;
        }
        // Move to the next question
        state.current_question_index += 1;
        ask_question();
      }
      
      // Filter the list of potential characters based on the answer
      capability filter_characters(answer: Boolean) {
        var question = state.questions[state.current_question_index];
        var new_characters = [];
        for (character in state.possible_characters) {
          if (check_character(character, question) == answer) {
            new_characters.append(character);
          }
        }
        state.possible_characters = new_characters;
      }
      
    
      // Check if a character matches a question
      capability check_character(character: String, question: String) : Boolean{
        switch (question) {
          case "Is it a human?":
            return is_human(character);
          case "Is it a male?":
            return is_male(character);
          case "Is it a fictional character?":
            return is_fictional(character);
          case "Is it from a movie?":
            return is_from_movie(character);
          case "Was it released after 2000?":
            return released_after_2000(character);
          default:
            return false;
        }
      }
      // Define characteristics for each character
      capability is_human(character: String): Boolean {
        switch (character) {
          case "Harry Potter":
          case "Hermione Granger":
          case "Batman":
          case "Iron Man":
          case "Superman":
          case "Wonder Woman":
          case "Captain America":
          case "Spider-Man":
            return true;
          case "Darth Vader":
          case "Luke Skywalker":
            return false; // Assuming they are considered droids/non-human
          default:
            return false;
        }
      }
    
      capability is_male(character: String): Boolean {
        switch (character) {
          case "Harry Potter":
          case "Batman":
          case "Iron Man":
          case "Superman":
          case "Captain America":
          case "Spider-Man":
          case "Darth Vader":
          case "Luke Skywalker":
            return true;
          case "Hermione Granger":
          case "Wonder Woman":
            return false;
          default:
            return false;
        }
      }
    
      capability is_fictional(character: String): Boolean {
        // All listed characters are fictional
        return true;
      }
    
      capability is_from_movie(character: String): Boolean {
        switch (character) {
          case "Harry Potter":
          case "Batman":
          case "Iron Man":
          case "Superman":
          case "Wonder Woman":
          case "Captain America":
          case "Spider-Man":
          case "Darth Vader":
          case "Luke Skywalker":
            return true;
          case "Hermione Granger":
            return false; // Assuming only Harry Potter is considered from a movie
          default:
            return false;
        }
      }
    
      capability released_after_2000(character: String): Boolean {
        switch (character) {
          case "Iron Man":
          case "Captain America":
          case "Spider-Man":
          case "Wonder Woman":
            return true;
          case "Harry Potter":
          case "Batman":
          case "Superman":
          case "Darth Vader":
          case "Luke Skywalker":
          case "Hermione Granger":
            return false;
          default:
            return false;
        }
      }
      // Make a guess
      capability make_guess {
        if (len(state.possible_characters) == 0) {
          publish "I give up! I couldn't guess your character.";
        } else if (len(state.possible_characters) == 1) {
          publish "My guess is: " + state.possible_characters[0] + "!";
        } else {
          publish "I'm not sure, but I think it might be one of these: " + join(state.possible_characters, ", ");
        }
        play_again();
      }
      
      // Ask the player if they want to play again
      capability play_again {
        publish "Would you like to play again? (yes/no)";
        subscribe "answer" as response;
        if (response == "yes") {
          state.current_question_index = 0;
          state.possible_characters = state.potential_answers;
          init();
        } else {
          publish "Thanks for playing!";
        }
      }
    }
    
    // Start the game
    AkinatorGame.start_game();
    

    Explanation:

    1. State Initialization:

      • questions: A list of yes-or-no questions.
      • potential_answers: A list of characters the game can guess.
      • current_question_index: Tracks the current question index.
      • possible_characters: Characters that still match the given answers, initialised with all potential answers.
    2. Capabilities:

      • start_game: Starts the game by invoking the init capability.
      • init: Greets the player and starts the first question by calling ask_question.
      • ask_question: Asks the current question from the questions list. If there are no more questions it calls make_guess.
      • await_answer: Waits for the player's response (yes or no), filters the characters based on the answer, and moves to the next question.
      • filter_characters: Filters the possible_characters based on the player's answer to the current question.
      • check_character: Determines if a character matches a given question by calling specific characteristic-checking capabilities.
      • is_human, is_male, is_fictional, is_from_movie, and released_after_2000: Capabilities that check specific characteristics of the characters.
      • make_guess: Makes a guess based on the remaining possible_characters. If there is only one character left it will guess that character, otherwise, it will list the remaining possible characters
      • play_again: Asks the player if they want to play again. If yes, it resets the game; if no, it ends the game.
    3. Game Flow:

      • The game starts with the start_game capability.
      • The init capability greets the player and starts the first question.
      • The ask_question capability asks questions one by one.
      • The await_answer capability waits for the player's response and filters the characters accordingly.
      • After all questions are asked, the make_guess capability attempts to guess the character.
      • The play_again capability asks if the player wants to play another round.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.