-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
746 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# pazaak | ||
|
||
## What is pazaak ? | ||
|
||
Pazaak is a game similar to blackjack that was originally a mini-game for the Star Wars: KOTOR series of videogames. | ||
|
||
It is played 1v1, with players taking turns drawing cards ranging from 1 to 10, trying to get the closest to 20 without going over. | ||
Each turn, a player may play a modifier card (+2, -4, ...) from his hand to alter the total. | ||
A game is played as best-of-5 (3 winning), and the hand cards are dealt only once at the start of the match. | ||
|
||
[More information on pazaak](http://starwars.wikia.com/wiki/Pazaak/Legends) | ||
|
||
## What's in this repository ? | ||
|
||
### Image files | ||
|
||
There are various apps available, but there are no official physical versions of pazaak cards. | ||
I created image files depicting the card fronts and backs, faithful to the KOTOR look & feel, which you can use as resources. | ||
These are available in the *Releases* section. | ||
|
||
I am not affiliated to BioWare / LucasArts in any way and am only distributing these in an attempt to spread the pazaak love. | ||
If this represents a legal issue I will remove them. | ||
|
||
### Command-line game engine | ||
|
||
You will find a CLI game engine that can run games and enforce rules. | ||
|
||
You can plug bot agents, or possibly human interfaces (untested). | ||
|
||
This is useful to simulate many games in a monte-carlo fashion, to analyze the value of modifier cards (+2, -4, +-3, ...). | ||
It may also be used as a basis to develop bot players. A naive but functional implementation is provided in **testagent/**. | ||
|
||
To run: | ||
|
||
```shell | ||
$ cd pazaakcli | ||
$ go build | ||
$ cd testagent | ||
$ go build | ||
$ cd .. | ||
# stdin line1 = side deck for player 1 | ||
# stdin line2 = side deck for player 2 | ||
$ ./pazaakcli -player ./testagent/testagent -player ./testagent/testagent <<EOF | ||
auto | ||
auto | ||
EOF | ||
``` | ||
|
||
### Statistical analysis | ||
|
||
The conclusions drawn from analysis conducted using the command-line engine will be provided in the form of a report file. | ||
Analysis still ongoing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
import "strings" | ||
|
||
type arrayFlags []string | ||
|
||
func (i *arrayFlags) String() string { | ||
return strings.Join([]string(*i), ", ") | ||
} | ||
|
||
func (i *arrayFlags) Set(value string) error { | ||
*i = append(*i, value) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
cat - >/dev/tty | ||
|
||
read -p "Move: " move </dev/tty >/dev/tty | ||
|
||
echo $move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/loopfz/pazaak/pazaakcli/pazaak" | ||
"github.com/loopfz/pazaak/pazaakcli/player" | ||
) | ||
|
||
func main() { | ||
|
||
var playerList arrayFlags | ||
flag.Var(&playerList, "player", "player program path") | ||
statsFile := flag.String("stats", "", "stats file") | ||
flag.Parse() | ||
|
||
var pl []*player.Player | ||
for _, p := range playerList { | ||
pl = append(pl, player.NewForkPlayer(p)) | ||
} | ||
|
||
g, err := pazaak.NewGame(pl, *statsFile) | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "[ERROR] %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
g.Run() | ||
} |
Oops, something went wrong.