[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a tool (#115) |
Date: |
Thu, 6 Jan 2022 21:59:25 -0500 (EST) |
branch: elpa/pacmacs
commit 775a2d3ec5aa30adff674b79397470087a819e8a
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Convert recorder module to a tool (#115)
---
pacmacs-recorder.el | 61 ---------------------------------------------
tools/it-recorder.el | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 61 deletions(-)
diff --git a/pacmacs-recorder.el b/pacmacs-recorder.el
deleted file mode 100644
index 689fa201a2..0000000000
--- a/pacmacs-recorder.el
+++ /dev/null
@@ -1,61 +0,0 @@
-;;; pacmacs-recorder.el --- Pacman for Emacs
-
-;; Copyright (C) 2015 Codingteam
-
-;; Author: Codingteam <codingteam@conference.jabber.ru>
-;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
-;; URL: http://github.com/rexim/pacmacs.el
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Routines for recording integration test cases
-
-;;; Code:
-
-(require 'cl-lib)
-
-(defvar pacmacs--tick-counter 0)
-(defvar pacmacs--recorded-actions nil)
-
-(defun pacmacs--reset-recorder ()
- (setq pacmacs--tick-counter 0)
- (setq pacmacs--recorded-actions nil))
-
-(defun pacmacs--save-test-case (filename)
- (interactive "fFile to save the test case: ")
- (with-temp-buffer
- (-> score-table
- (pp-to-string)
- (insert))
- (write-file filename)))
-
-(defun pacmacs--record-action (action-name)
- (add-to-list 'pacmacs--recorded-actions
- (cons action-name pacmacs--tick-counter)))
-
-(defun pacmacs--inc-tick-counter ()
- (incf pacmacs--tick-counter))
-
-(provide 'pacmacs-recorder)
-
-;;; pacmacs-recorder.el ends here
diff --git a/tools/it-recorder.el b/tools/it-recorder.el
new file mode 100644
index 0000000000..de399dbfc4
--- /dev/null
+++ b/tools/it-recorder.el
@@ -0,0 +1,70 @@
+(require 'pacmacs)
+
+(require 'cl-lib)
+
+(defvar pacmacs--tick-counter 0)
+(defvar pacmacs--recorded-actions nil)
+
+(defun pacmacs--record-action (action-name)
+ (add-to-list 'pacmacs--recorded-actions
+ (cons action-name pacmacs--tick-counter)))
+
+(defun pacmacs--reset-recorder ()
+ (setq pacmacs--tick-counter 0)
+ (setq pacmacs--recorded-actions nil))
+
+(defun pacmacs--save-test-case (filename)
+ (interactive "FFile to save the test case: ")
+ (with-temp-buffer
+ (-> pacmacs--recorded-actions
+ (pp-to-string)
+ (insert))
+ (write-file filename)))
+
+(defun pacmacs-record-up ()
+ (interactive)
+ (pacmacs--record-action 'up)
+ (pacmacs-up))
+
+(defun pacmacs-record-down ()
+ (interactive)
+ (pacmacs--record-action 'down)
+ (pacmacs-down))
+
+(defun pacmacs-record-left ()
+ (interactive)
+ (pacmacs--record-action 'left)
+ (pacmacs-left))
+
+(defun pacmacs-record-right ()
+ (interactive)
+ (pacmacs--record-action 'right)
+ (pacmacs-right))
+
+(defun pacmacs-record-tick ()
+ (interactive)
+ (cl-incf pacmacs--tick-counter)
+ (pacmacs-tick))
+
+(define-derived-mode pacmacs-it-recorder-mode pacmacs-mode
"pacmacs-it-recorder-mode"
+ (define-key pacmacs-it-recorder-mode-map (kbd "<up>") 'pacmacs-record-up)
+ (define-key pacmacs-it-recorder-mode-map (kbd "<down>") 'pacmacs-record-down)
+ (define-key pacmacs-it-recorder-mode-map (kbd "<left>") 'pacmacs-record-left)
+ (define-key pacmacs-it-recorder-mode-map (kbd "<right>")
'pacmacs-record-right))
+
+(defun pacmacs--start-it-recorder ()
+ (interactive)
+ (switch-to-buffer pacmacs-buffer-name)
+ (pacmacs-it-recorder-mode)
+
+ (setq pacmacs-lives 3)
+ (setq pacmacs-score 0)
+ (setq pacmacs-levels (pacmacs--get-list-of-levels))
+ (setq pacmacs-current-level 0)
+ (pacmacs--reset-recorder)
+
+ (pacmacs--load-current-level)
+ (pacmacs--switch-to-play-state)
+
+ (unless pacmacs-timer
+ (setq pacmacs-timer (run-at-time nil (* pacmacs-tick-duration-ms 0.001)
'pacmacs-record-tick))))
- [nongnu] elpa/pacmacs 9527a965e1 134/472: Merge branch 'switch-game-state-in-logic-functions-97'. Close #97, (continued)
- [nongnu] elpa/pacmacs 9527a965e1 134/472: Merge branch 'switch-game-state-in-logic-functions-97'. Close #97, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 86f76c4bef 129/472: Implement switching level mechanics. Close #79, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fa41daf2ca 149/472: Merge branch 'master' into score-table-92, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 85069784fb 147/472: Add a couple of new maps., ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 39fc09baf3 161/472: Load cl-lib.el for using its macros and functions, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9ddaedae20 174/472: UT for pacmacs--file-content-test, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b6141dc8e3 175/472: UT for pacmacs--anim-object-list-next-frame, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1186dcdaa1 197/472: Double dash pacmacs-render-state function (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 57b0e8566b 204/472: Get pacmacs-quit back, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 531386d7f1 208/472: Merge pull request #128 from rexim/readme-fix, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a tool (#115),
ELPA Syncer <=
- [nongnu] elpa/pacmacs a0d9c1bbbc 212/472: Reverse test case before saving (#115), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d5bdd0b20a 025/472: Slightly refactored pacman-anim:, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 16b0d6583a 153/472: Get rid of the hardcoded level list. Close #109, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 68f6dc9a93 167/472: Update MELPA repo link, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fe837b20fa 184/472: Implement victory animation for ghosts. Close #89, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 09ad044887 232/472: Better color for walls (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9c69162781 247/472: Rough implementation of XPM wall generation (#141), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4a94a72dd4 250/472: Remove generate-wall-tiles script tool (#141), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs eab5b98b05 254/472: Add average-tick-time function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4bd94d2058 255/472: Merge branch 'master' into big-pills-81, ELPA Syncer, 2022/01/06