Git Product home page Git Product logo

emacs-klondike's Introduction

Emacs Klondike

Klondike solitaire for Emacs

How to Download/Install

This package is on Melpa; you can install it by running M-x list-packages in Emacs and searching for klondike, if you have the Melpa repository loaded by Package. If you don’t have the repository added – yet –, you can find instructions for how to add it at the Melpa Github page.

How to Use

You can launch a game by running M-x klondike; if a game is already running, its buffer will be brought to the forefront.

A new game will look like so: https://codeberg.org/WammKD/Emacs-Klondike/raw/branch/primary/2023-02-14T16:02:05,946226379-06:00.png

To select any of the bottom 7 rows, press any key 1 through 7.

To select any of the top-right stacks, press !, @, #, or $ (from left, to right).

To select any face-up cards moved from the face-down stack (in the top-left corner of the screen), press 0.

If multiple cards are available to move, the visible portion of the stack will be numbered so that you can specify the depth of the stack you want to move: https://codeberg.org/WammKD/Emacs-Klondike/raw/branch/primary/2023-02-14T16:27:21,058570768-06:00.png

You can select a particular number using the function keys; using F2, we should get: https://codeberg.org/WammKD/Emacs-Klondike/raw/branch/primary/2023-02-14T16:35:14,119336525-06:00.png

This will move the 4 of spades and any cards which reside on top of it. If there is only one card face-up on any stack, that card will be selected automatically.

To move the card(s) you’ve selected, use the same key-bindings which’re used to pick a stack to select cards from (except for 0; you cannot move cards to this area other than from the face-down stack).

There are three shortcuts, given their frequency of use: in lieu of using the function keys

  • selecting one of the bottom-row stacks (keys 1 through 7) will attempt to move all visible cards of your picked stack to the new stack you’ve selected
  • selecting one of the top-right stacks (keys !, @, #, and $, from left, to right) will attempt to move the top-most visible card of your picked stack to the top-right stack you’ve selected
  • TAB will check if any of the top-right stacks are able to accept the top-most visible card of your picked stack; if you can move this top-most visible card to any of them, it will get moved automatically, for you

Finally, – to flip a card from the face-down stack to face-up – use SPC.

Reassigning Key-bindings

There are, essentially, three major modes that Klondike can exist in, covered (informally) above:
  • klondike-mode (the initial mode you enter upon any Klondike game)
  • klondike-picker-mode (the mode the game uses when picking a card depth from the visible cards of a particular stack)
  • klondike-select-mode (the mode the game uses when you are selecting a stack to move your picked cards to)

Their bindings are laid out, below, for each mode; to redefine any key-binding, use define-key and the mode-map of the respective mode and the function/~lambda~ specified by the tables, below.

Klondike Mode

KeyFunction
SPC#'klondike-card-deck-next
0(lambda () (interactive) (klondike--stack-pick-or-select 'faceup))
!(lambda () (interactive) (klondike--stack-pick-or-select 'empty 0))
@(lambda () (interactive) (klondike--stack-pick-or-select 'empty 1))
#(lambda () (interactive) (klondike--stack-pick-or-select 'empty 2))
$(lambda () (interactive) (klondike--stack-pick-or-select 'empty 3))
1(lambda () (interactive) (klondike--stack-pick-or-select 'pile 0))
2(lambda () (interactive) (klondike--stack-pick-or-select 'pile 1))
3(lambda () (interactive) (klondike--stack-pick-or-select 'pile 2))
4(lambda () (interactive) (klondike--stack-pick-or-select 'pile 3))
5(lambda () (interactive) (klondike--stack-pick-or-select 'pile 4))
6(lambda () (interactive) (klondike--stack-pick-or-select 'pile 5))
7(lambda () (interactive) (klondike--stack-pick-or-select 'pile 6))
C-/#'klondike-history-prev
C-_#'klondike-history-prev
<undo>#'klondike-history-prev
C-x u#'klondike-history-prev
q#'quit-window
Q#'klondike-quit-game

Klondike Picker Mode

KeyFunction
TAB#'klondike-stack-find-available-empty
F1(lambda () (interactive) (klondike--stack-pick 1))
F2(lambda () (interactive) (klondike--stack-pick 2))
F3(lambda () (interactive) (klondike--stack-pick 3))
F4(lambda () (interactive) (klondike--stack-pick 4))
F5(lambda () (interactive) (klondike--stack-pick 5))
F6(lambda () (interactive) (klondike--stack-pick 6))
F7(lambda () (interactive) (klondike--stack-pick 7))
F8(lambda () (interactive) (klondike--stack-pick 8))
F9(lambda () (interactive) (klondike--stack-pick 9))
F10(lambda () (interactive) (klondike--stack-pick 10))
F11(lambda () (interactive) (klondike--stack-pick 11))
F12(lambda () (interactive) (klondike--stack-pick 12))
C-g#'klondike-stack-pick-or-select-quit

Klondike Select Mode

KeyFunction
TAB#'klondike-stack-find-available-empty
!(lambda () (interactive) (klondike--stack-select 'empty 0))
@(lambda () (interactive) (klondike--stack-select 'empty 1))
#(lambda () (interactive) (klondike--stack-select 'empty 2))
$(lambda () (interactive) (klondike--stack-select 'empty 3))
1(lambda () (interactive) (klondike--stack-select 'pile 0))
2(lambda () (interactive) (klondike--stack-select 'pile 1))
3(lambda () (interactive) (klondike--stack-select 'pile 2))
4(lambda () (interactive) (klondike--stack-select 'pile 3))
5(lambda () (interactive) (klondike--stack-select 'pile 4))
6(lambda () (interactive) (klondike--stack-select 'pile 5))
7(lambda () (interactive) (klondike--stack-select 'pile 6))
C-g#'klondike-stack-pick-or-select-quit

Simplified Key-bindings

The above key bindings are the default. Some found it cumbersome to have to use a different set of keys between selecting a stack and, then, picking a card – of the face-up cards in the stack – to move from said stack so there are an alternative set of bindings that simplifies this.

If you set the variable klondike-simplified-card-moving-p to t, picking a particular tableau (using 1 through 7) will then, still, assume that using 1 through 7, again, means you want to move all of the available cards in the tableau to another tableau but, if the tableau specified isn’t a valid stack to move the cards, Klondike will assume you meant to select one of the available face-up cards to, then, move only a portion of the cards to another tableau.

So, if you press 5, Klondike will check if it can move all of the face-up cards of the currently selected tableau to tableau 5; if it cannot, it will select the face-up card labeled with 5 in the currently selected tableau so you can move only those cards (an operation that, previously, had to be done with F5 in order for Klondike to tell whether you wanted to move everything of the currently selected stack or select a subsection of the currently selected stack).

emacs-klondike's People

Contributors

wammkd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.