Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 committed Mar 13, 2024
1 parent 5ffae3a commit 4a32cef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

A library that creates and shuffles a deck of cards from which you can draw

The code builds but it's not yet complete.

Tested with the the development version of [zig](https://ziglang.org/) (may
not build with the last release).

Expand All @@ -23,8 +21,12 @@ not build with the last release).
// Seed the random number generator
var rng = std.rand.DefaultPrng.init(@as(u64, @intCast(std.time.milliTimestamp())));
// Shuffle
Deck.shuffle(&deck, &rng.random());
// Draw one card
const card = Deck.getTopCard(&deck) orelse return;
try std.testing.expectEqual(Suit.Clubs, card.suit);
try std.testing.expectEqual(Face.Queen, card.face);
Expand Down
25 changes: 25 additions & 0 deletions src/root.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
//
// MIT License
//
// Copyright (c) 2024 Andy Alt (arch_stanton5995@proton.me)
// Project URL: https://github.com/andy5995/zigdeck
//
// 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.
//

const std = @import("std");

pub const Suit = enum {
Expand Down

0 comments on commit 4a32cef

Please sign in to comment.