some revisions
This commit is contained in:
parent
322dcfe01a
commit
1208ae6a8f
6 changed files with 14 additions and 14 deletions
|
|
@ -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 "<year>.<month>.<counter>", 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 "<year>.<month>.<counter>".<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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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 "<year>.<month>.<counter>", 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 "<year>.<month>.<counter>".<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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue