%@ page language="java" contentType="text/html;charset=utf-8" %> <%@ page import="java.util.Vector" %> <%@ page import="org.crosswire.flashcards.LessonManager" %> <%@ page import="org.crosswire.flashcards.LessonSet" %> <%@ page import="org.crosswire.flashcards.Lesson" %> <%@ page import="org.crosswire.flashcards.FlashCard" %> <%@ page import="org.crosswire.flashcards.Quizer" %> <% Quizer quizer = (Quizer)session.getAttribute("fcquizer"); if (quizer == null) return; FlashCard currentWord = (FlashCard)session.getAttribute("fcword"); Vector answers = (Vector)session.getAttribute("fcanswers"); Integer w = (Integer)session.getAttribute("fcwrong"); int wrong = -1; if (w != null) wrong = w.intValue(); String status = "Begin"; String c = request.getParameter("c"); if (currentWord != null) { boolean correct = false; try { correct = answers.elementAt(Integer.parseInt(c)).equals(currentWord.getBack()); } catch (Exception e) {} if (correct) { status = "Correct"; currentWord = null; } else { status = "Try again"; session.setAttribute("fcwrong", new Integer(++wrong)); } } if ((currentWord == null || answers == null)) { currentWord = quizer.getRandomWord(wrong); answers = quizer.getRandomAnswers(7); session.setAttribute("fcword", currentWord); session.setAttribute("fcanswers", answers); session.setAttribute("fcwrong", new Integer(0)); c = null; } if (currentWord != null) { %>