
// JepArt.java
// Andrew Davison, ad@coe.psu.ac.th, July 2023

/* Calls the Art module in Python. This is a 
   third-part module for generating ASCII art
   (https://pypi.org/project/art/).

  Usage:
     > compile JepArt
     > run JepArt 

  Based on Python test code in artTests.py
*/

import java.util.*;

import jep.*;
import jep.python.*;


public class JepArt 
{

  public static void main(String[] args) 
                       throws JepException 
  {
    System.out.println("Starting Jep...");
    Interpreter jep = new SharedInterpreter();

    jep.exec("from art import *");

    // two ways to get a string...
    String art = jep.getValue(
                   "text2art('test', font='bulbhead')", 
                   String.class);
    System.out.println(art + "\n");

    art = (String) jep.getValue("text2art('test', font='random')");
    System.out.println(art);

    jep.close();
  } // end of main()

} // end of JepArt class
