some revisions

This commit is contained in:
polos 2017-01-24 16:34:42 +01:00
parent 322dcfe01a
commit 1208ae6a8f
6 changed files with 14 additions and 14 deletions

View file

@ -611,7 +611,7 @@ Returns the Lisp value of the <code>QVariant</code> object.
<br><br>
<b>QVERSION ()</b>
<br><br>
Returns the EQL version number as "&lt;year&gt;.&lt;month&gt;.&lt;counter&gt;", analogous to the ECL version number.<br>The second return value is the Qt version as returned by <code>qVersion()</code>.
Returns the EQL version number as "&lt;year&gt;.&lt;month&gt;.&lt;counter&gt;".<br>The second return value is the Qt version as returned by <code>qVersion()</code>.
<br>
<br><br>
<b>TR (source &optional context plural-number)</b>

View file

@ -23,6 +23,12 @@
;;; game
(defun tic-tac-clicked (index)
(when (and (qml-get "game" "running")
(can-play-at-pos index))
(unless (make-move index "X")
(computer-turn))))
(defun winner ()
(dotimes (i 3)
(when (or (and (not (empty-cell i))
@ -41,6 +47,7 @@
(return-from winner t)))
(defun restart-game ()
(qml-set "messageDisplay" "visible" nil)
(qml-set "game" "running" t)
(dotimes (i 9)
(set-cell-state i "")))
@ -57,6 +64,7 @@
(empty-cell pos)))
(defun computer-turn ()
(qsleep 1/7)
(let ((r (random 10)))
(if (< r (qml-get "game" "difficulty"))
(smart-ai)

View file

@ -34,7 +34,7 @@
;;; function calls from QML
(defun print-js-readably (object)
"Prints lists, vectors, T, NIL, floats in JS notation, which will be passed to JS 'eval()'."
"Prints (nested) lists, vectors, T, NIL, floats in JS notation, which will be passed to JS 'eval()'."
(if (and (not (stringp object))
(vectorp object))
(print-js-readably (coerce object 'list))

View file

@ -38,12 +38,7 @@ Rectangle {
width: board.width / 3
height: board.height / 3
onClicked: {
if (game.running && Lisp.fun("can-play-at-pos", index)) {
if (!Lisp.fun("make-move", index, "X"))
Lisp.fun("computer-turn");
}
}
onClicked: { Lisp.fun("tic-tac-clicked", index) }
}
}
}
@ -81,10 +76,7 @@ Rectangle {
Timer {
running: messageDisplay.visible
onTriggered: {
messageDisplay.visible = false;
Lisp.fun("restart-game");
}
onTriggered: { Lisp.fun("restart-game") }
}
}
}

View file

@ -34,7 +34,7 @@
;;; function calls from QML
(defun print-js-readably (object)
"Prints lists, vectors, T, NIL, floats in JS notation, which will be passed to JS 'eval()'."
"Prints (nested) lists, vectors, T, NIL, floats in JS notation, which will be passed to JS 'eval()'."
(if (and (not (stringp object))
(vectorp object))
(print-js-readably (coerce object 'list))

View file

@ -2903,7 +2903,7 @@ cl_object qvariant_equal2(cl_object l_var1, cl_object l_var2) {
cl_object qversion() {
/// args: ()
/// Returns the EQL version number as "&lt;year&gt;.&lt;month&gt;.&lt;counter&gt;", analogous to the ECL version number.<br>The second return value is the Qt version as returned by <code>qVersion()</code>.
/// Returns the EQL version number as "&lt;year&gt;.&lt;month&gt;.&lt;counter&gt;".<br>The second return value is the Qt version as returned by <code>qVersion()</code>.
const cl_env_ptr l_env = ecl_process_env();
l_env->nvalues = 2;
l_env->values[0] = from_cstring(EQL::version);