\documentclass[pdftex]{article}
\usepackage[czech]{babel}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage[pdftex]{web}
\usepackage{amsmath}
\usepackage[pdftex]{eforms}
\usepackage[lang=custom]{dps}
\randomi=704908510
\usepackage{rotating}

\usepackage{xcolor}


%------------------------------------------------------------------------

\def\picturedefinecolor#1#2#3#4{%
    \definecolor{picturecolor#1}{rgb}{#2,#3,#4}
    \expandafter\def\csname picturecolor#1\endcsname{rgb(#2,#3,#4)}
}
 
 
\picturedefinecolor{a}{0.99}{0.66}{0.3}      %oranžová
%\picturedefinecolor{a}{0.99}{0.89}{0.23}    %žlutá   
%\picturedefinecolor{a}{0.8}{0.8}{0.8}       %šedá    

\picturedefinecolor{b}{0}{0}{0}            %barva funkcí - černá
\picturedefinecolor{c}{0}{0}{0.5}          %barva nadpisů - modrá 

\definecolor{Myblue}{rgb}{1,1,0.99}   %barva pozadí - světle krémová
\pagecolor{Myblue}

%------------------------------------------------------------------------



\threshold{0}
\penaltypoints{1}
\passing{0}

\begin{insDLJS}[processChoiceB]{matchB}{JS Update of Matching PuzzleB}
function processChoice(fieldname)
{
    // Get the question field that corresponds to this question,
    // see if checked.
    var f = this.getField("ckbxQ."+fieldname);
    if ( (f != null) && (f.isBoxChecked(0)) ) { // right
        clearRedCrosses ();
        this.resetForm(["puzzle."+fieldname]);
        event.target.textColor = ["RGB",0.2, 0.4, 0.8];
        f.strokeColor = color.transparent;
        f.strokeColor = ["RGB", 0.2, 0.4, 0.8];
        f.fillColor = ["RGB", 0.2, 0.4, 0.8];
        f.readonly = true;
        event.target.readonly=true;
        checkForFinished(\dspassing);
    } else { // wrong
        if ( activeQuestion != "" ) var h = this.getField(activeQuestion);
        if ( (activeQuestion=="") || (h.readonly) ) { // active question already answered
            event.target.value = "Off";
//            var g = this.getField("report");
            str = \chooseQ;
//            g.value = str;
            app.alert(str);
            var to = app.setTimeOut("clearMessages()", 2000);
        } else {
            event.target.style = style.cr;
            event.target.textColor = color.red;
            ++nMissed;
            if ( typeof missesByQuestion[activeQuestion] !="number" )
                missesByQuestion[activeQuestion] = 1;
            else
                missesByQuestion[activeQuestion] += 1;
            if (missesByQuestion[activeQuestion] > \dsthreshold) {
//                var f = this.getField("report");
                str = \triedTooMuch;
//                f.value = str;
                app.alert(str);
                nPenaltyPoints += \dspenaltypoints;
                missesByQuestion[activeQuestion] = 0;
                clearRedCrosses ();
                var to = app.setTimeOut("clearMessages()", 2000);
              }
        }
    }
}

function hideReport(){
  var g = this.getField("report");
  g.hidden = true;
}

function checkForFinished(n)
{
    var f = this.getField("puzzle");
    var g = f.getArray();
    var anyEmpty = false;
    for ( var i=0; i < g.length; i++) {
        if ( (g[i].name != "puzzle.space") && (g[i].value.replace(/\s/g,"") == "") ) {
            anyEmpty = true;
            break;
        }
    }
    var nTotalPenaltyPoints=nMissed + nPenaltyPoints;
    if ( !anyEmpty ) {
        var f = this.getField("report");
        str = \congratFinished
        + "\n" + \regretPleased
        + "\n" + \reportPenaltyPoints
        + "\n" + \finalPenaltyScore
        + " " + finalRating(nTotalPenaltyPoints);
        app.alert(str);
        var f = this.getField("ckbxA");
        h = f.getArray();
        for ( i=0; i < h.length; i++) h[i].hidden = true;
//        app.alert(str);
    }
}

\end{insDLJS}

\everymath{\displaystyle}
\DeclareMathOperator{\tg}{tg}
\DeclareMathOperator{\cotg}{cotg}
\DeclareMathOperator{\arctg}{arctg}
\DeclareMathOperator{\arccotg}{arccotg}
\newcommand{\dx}{\mathrm{d}\mkern1mu x}
\newcommand{\dy}{\mathrm{d}\mkern1mu y}


\margins{0.1in}{0.1in}{0.5in}{0.05in}
\screensize{6in}{8in}
\rowsep{5ex}

\parindent0pt
\parskip6pt

\DeclarePuzzle{{a}{a}{b}{b}{c}{c}{d}{d}{e}{e}{f}{f}}
\begin{Composing}
 \begin{cQ}{a}
$22 \cdot 7$
  \end{cQ}
  \begin{cA}{a}
154
  \end{cA}
  \begin{cQ}{b}
$11 \cdot 9$
  \end{cQ}
  \begin{cA}{b}
99
  \end{cA}
  \begin{cQ}{c}
$8 \cdot 12$
  \end{cQ}
  \begin{cA}{c}
96
  \end{cA}
  \begin{cQ}{d}
$7 \cdot 80 $
\end{cQ}
\begin{cA}{d}
560
  \end{cA}
\begin{cQ}{e}
$13 \cdot 6 $
\end{cQ}
\begin{cA}{e}
78
  \end{cA}
\begin{cQ}{f}
$21 \cdot 10 $
\end{cQ}
\begin{cA}{f}
210
  \end{cA}


\begin{cA}{A}
155
\end{cA}

\begin{cA}{B}
88
\end{cA}

\begin{cA}{C}
69
\end{cA}

\begin{cA}{D}
650
\end{cA}

\begin{cA}{E}
87
\end{cA}

\begin{cA}{F}
120
\end{cA}

\end{Composing}

\makeatletter
\def\aeb@@Puzzle{\begin{center}{\leavevmode\smash{\Large
\textcolor{picturecolorc}{Potěšení je znamením životní}}\qquad}\@aebPuzzlei}%
\def\@aebPuzzleDone{\end{center}\ds@buildAnswerKey}%
\def\eq@tabSep{\ \ }
\makeatother


\PuzzleAppearance{\textSize{12}}

\begin{document}
\thispagestyle{empty}
\Large

\insertPuzzle{6}

Vypočtěte a vyberte správné výsledky

\textcolor{picturecolorc}{\textbf{Otázky}}
\begin{multicols}{6}
\begin{enumerate}
\displayRandomizedQuestions
\end{enumerate}
\end{multicols}

\textcolor{picturecolorc}{\textbf{Odpovědi}}
\begin{multicols}{6}
\begin{enumerate}
\displayRandomizedAnswers
\end{enumerate}
\end{multicols}




\textcolor{picturecolorc}{\textbf{Instrukce:}}

Výběr otázky provedete kliknutím na číslo, které se u ní nachází.
Poté v části odpovědi označíte možnou odpověď. Za každou chybnou odpověď
získáváte trestný bod.

%Maximum pokusů je stanoven na
% $\dsthreshold$, než dostanete $\dspenaltypoints$ trestných bodů. 
%Celkem jsou povoleny $\dspassing$ chybné
%odpovědi.
\vfill
\small
Autor citátu: Aristoteles\hfill\copyright\ 2013 R. Plch, P. Šlimar
\end{document}
