在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:PacVim开源软件地址:https://gitee.com/mirrors/PacVim开源软件介绍:PacVimPacVim is a game that teaches you vim commands.You must move pacman (the green cursor) to highlight each word on the gameboard while avoiding the ghosts (in red). Building and runningVim is a great tool to write and edit code, but manypeople, including me, struggled with the steep learning curve.I did not find a fun, free way to learn about the vim commandsin-depth, and thus, PacVim was born. Inspired by the classic,PacMan, PacVim is a game that'll give anyone plenty ofpractice with the vim commands while being a ton of fun to play. Download and build the game with: Mac OS X
Linux (and Mac OS X alternative)
2. git clone https://github.com/jmoon018/PacVim.git3. cd PacVim4. [sudo] make install Using DockerIf you have docker installed already, you can just: docker run -it freedomben/pacvim [LEVEL_NUMBER] [MODE] Building the docker image from sourceFrom the project root, build the image: docker build -t freedomben/pacvim . Push to docker hub: docker push freedomben/pacvim To play, run (from anywhere): $ pacvim [LEVEL_NUMBER] [MODE] You may specify the starting level and mode ( $ pacvim 8 n To Uninstall, navigate to the folder where you cloned this repo, and type How To PlayThe objective of PacVim is very similar to PacMan.You must run over all the characters on the screen while avoiding the ghosts (red
You are given three lives. You gain a life each time you beatlevel 0, 3, 6, 9, etc. There are 10 levels, 0 through 9. Afterbeating the 9th level, the game is reset to the 0th level, butthe ghosts move faster. Winning conditions: Use vim commands to move the cursorover the letters and highlight them. After all letters arehighlighted, you win and proceed to the next level. Losing conditions: If you touch a ghost (indicatedby a red List of Implemented Commands
Create Your Own Map!The maps for PacVim are loaded from text files fromthe /usr/local/share/pacvim-maps folder. After installing, you may, instead, use the maps folder (where you installedthe game) by calling The name of each text file must bein a format such as: In the map text file, the walls are denoted by ampersands Creating Ghosts and Players Ghost: Player: Code Overviewavatar.cppContains the `avatar` class, which contains information aboutthe player, such as his/her x position, y position, etc. Italso contains methods that allow the player to move and correspondto the keystrokes. For example, the `avatar` class contains the methodcalled `parseWordForward(bool)` which implements the functionalityfor the "w" (or "W" if true) vim command.ghost1.cppContains the Ghost1 class, derived from the `avatar` class. It isjust like the avatar class, but it requires an extra paremeterupon initialization, called `sleepTime`, a double value thatdetermines how quickly a ghost moves. It refers to the time, inseconds, the ghost must wait to move. A `sleepTime` of 0.5 meansthe ghost moves 2 times a second. `sleepTime` = 0.33 is 3 moves per second, etc.The `Ghost1` class also contains a method called `spawnGhost` whichcreates the ghost at the location based on its initialization parameters.The ghost will appear when `READY` (global bool) is true (this means the playeris ready), and it will call `ghost.think()` one second afterwards. `think` is a recursive method that simply moves the ghost. It uses a basic greedy algorithm based on the distance of the ghost's potentialmoves (up, down, right, left) and the player. Each ghost contains its own thread. A global mutex, called
game.cppThis contains the main() method among many other important onesmain - contains a loop that breaks when To-dos / Bugs
LICENSEPacVim is free software: you can redistribute it and/or modifyit under the terms of the GNU Lesser General Public License (LGPL) as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.PacVim is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public Licensealong with this program. If not, see http://www.gnu.org/licenses/. |
请发表评论