Skip to content

Commit

Permalink
README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaoir committed Nov 12, 2018
1 parent df6fbf2 commit 0756d82
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 126 deletions.
157 changes: 31 additions & 126 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,62 @@
This is the initial public release of October 2018
### Introduction

This code may be helpful for people learning how to write WebAssembly apps in Go.
Just please keep in mind that this is not a finished program, and support
for WebAssembly is new.
This is the initial public release of November 2018

You will see code for features that are under development, and some things
may not work right. Some code may not be as concise as possible, which may
change in the future, or remain as-is for some good reason.
To play the game:

Also, I am not a big supporter of "idiomatic" discipline. My aim is to write
the best code I can, rather than to follow ideas that happen to be popular,
fashionable, or dogmatic.
http://jayts.com/vp

There are some odd behaviors you may notice in the app:

Starting the game
-----------------
### Starting the game

So far, it seems to work well on either Linux or Windows, using an up-to-date
version of Firefox, Opera, or Chrome. Browser support on mobile devices is
more limited. You may need to wait some seconds (up to 12 seconds on my
old tablet), or the game may not finish loading at all (usually when using
Firefox). This may be due to a bug in either the Go wasm compilation or
in one or more browser's support for WebAssembly (at least, the kind
produced by the Go compiler). One of the reasons I'm publishing this
before it is more complete is so that this issue can be demonstrated
and discussed.

Ending the game
---------------
version of Firefox, Opera, or Chrome.

Upon a q ("quit") or e ("exit") keypress, the game shows an end-of-game
message, then just stops and becomes completely unresponsive. That is
because the Go program exited!
Browser support on mobile devices is more limited. You may need to wait
some seconds (up to 12 seconds on my old tablet) for the game to load.
Chrome and Opera seem to work well.

To start a new game, the page must be reloaded. This will work
more elegantly in a future release.
Firefox on mobile is problematic. The app may start properly the first
time the page is loaded, but reloading the page may result in the WebAssembly
app not starting. (This is a suspected bug in Go's WebAssembly support or the Firefox browser.)
At the worst, you may need to clear the browser cache and
restart Firefox to get it to work again. Before that, you can try just
restarting the browser, and please let me know if that worked for you.

### Introduction
One of the reasons I'm publishing this before it is more complete
is so that this issue can be demonstrated and discussed.

This is the Go version of videopoker.
### Ending the game

I did this because I was wondering how long it would take to tranlate a 1000-line C program into Go.
It took about 8 hours. It was not difficult at all, but some things had to be rewritten into the way things are done in Go: no pointer arithmetic, and different handling of Unicode, random number generation, and STDIN/STDOUT input and output.
Upon a q ("quit") or e ("exit") keypress, the game shows an end-of-game message,
then just stops and becomes completely unresponsive. That is because the Go program
exited. This is a holdover from the console version, and will work more elegantly
in a future release.

### Quick Start
For now, reload the page to start a new game.

To get it working, just run
### How to Play

```
$ go build videopoker.go
$ videopoker
```

See the manual page below for directions on how to play.
### Building from Source

### Project Description

A text-based video poker for Linux.

Many variants of video poker found in casinos are included as options.

The cards can be displayed as black or color characters, and also as Unicode
card faces.

It's a great way to practice your strategy for fun, or before going to a casino.
The text-based playing action allows for quick play and more rapid training than
with a GUI application.

### Screenshots

Colored Text (`-u1` option)

![screenshot 1](/images/VideoPoker-01-PlainText.png)
Many variants of video poker are included as options. (Currently accessible
only using the A-I keys.)

Unicode Suits (`-u2` option, default)

![screenshot 2](/images/VideoPoker-02-UnicodeSuits.png)
### Screenshots

Unicode Card Faces (`-u3` option)
Example of good luck:

![screenshot 3](/images/VideoPoker-03-FullUnicode.png)
![screenshot 1](/images/VideoPoker-StraightFlush.png)

### Manual Page

```
VIDEOPOKER(6) Games Manual VIDEOPOKER(6)
NAME
videopoker - a text-based video poker game
SYNOPSIS
videopoker [-b] [-b1] [-g game] [-is #chips] [-k 5-char-string] [-mh]
[-q] [-uD] [-v]
Expand Down Expand Up @@ -162,11 +127,6 @@ HOW TO PLAY
ing, where it will stay until you change it.
OPTIONS
-b
("Bold") Use boldface text output to display the cards. (When using the
-u1 and -u2 options only.)
-b1
("Bet 1") Use a minimum bet of one chip, rather than the default ten.
Expand Down Expand Up @@ -195,56 +155,6 @@ OPTIONS
("Initial Score") Start the game with integer chips, rather than the
default 1000. integer may be in the range of 1 to 100,000.
-k "string"
("Keys") Replace the standard " jkl;" input keys with the ones in
string, which must be 5 characters long and not contain a q or w char‐
acter.
-mh
("Mark Held") Print + characters under the cards that are held. This
option is helpful for new players, and also when testing the string
supplied with the -k option.
-q
("Quiet") Don´t print the banner at the start of the game, nor the
final message.
-uD
("Unicode") Control Unicode output. D is a digit from 0 to 3.
-u0 As with -u1, except all text is displayed in the default
color. (For monochrome terminals, or any terminals that
do not support ANSI escape codes.)
-u1 No Unicode. Suits are displayed with the characters C,
D, H, and S. Diamonds and hearts are displayed in red,
clubs and spades are displayed in the default text color.
-u2 (default) Display suits using Unicode playing card
suit symbols.
-u3 (Experimental) Display entire cards as Unicode characters.
In order for the -u1 or -u2 options to work, videopoker needs to use a
font that contains the necessary Unicode playing card characters. On
Linux, the monospace and DejaVu fonts may be used.
For -u2 to work, the system needs to be able to properly display Uni‐
code playing card characters.
Unicode playing card faces appear no larger than other text characters.
When using the -u2 option, increase the font size as necessary (i.e.,
24 pixels or larger).
-v
("Version") Print the version number and exit.
BUGS
When played with the (experimental) -u3 option, cards may not be
equally spaced apart. This may be due to improper handling of ANSI
Expand All @@ -259,12 +169,7 @@ AUTHOR
(http://jayts.com)
COPYRIGHT
Copyright 2016 Jay Ts
Copyright 2016-2018 Jay Ts
Released under the GNU Public License, version 3.0 (GPLv3)
(http://www.gnu.org/licenses/gpl.html)
Jay Ts December 2016 VIDEOPOKER(6)
```
Binary file added images/VideoPoker-StraightFlush.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0756d82

Please sign in to comment.