Giter Club home page Giter Club logo

zhithead's People

Contributors

aod avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zhithead's Issues

Fix browser preload warnings

Firefox and I'm sure other browser give the same warning when using preload and not using the resource soon after:

image

Either way, this was a hack for when the bot is playing a card or human is taking a card from the deck. The animation would be in progress while at the same time the browser would load the card image. This would mess up the animation.

Clearly it's not desirable for the player to preload every card asset in their browser. So this should get fixed, eventually...

One possible fix is to bundle the SVGs by importing/exporting them in a module. This will increase the bundle size. The total uncompressed size of all card assets is 2.66 MB.

Another solution could be looking at the top X cards of the deck and "preloading" the assets. Even only preloading the top most card of the deck should be good enough. The biggest card size with a face is 266 KB and non-face cards are ~15 KB.

Although depending on the player's internet stability bundling might be the better option. And also when the player goes offline they wouldn't be able to load further card assets.

Encode the game state in the URL of the browser

Just an interesting idea of encoding the game state in the URL. This would allow the player to go back and forwards to undo and redo their moves and also share the URL. It really sounds like a gimmick but it's interesting for me nonetheless.

One con I can think of would be that the player would have infinite redo and undos. But I think the goal is not to make a perfectly balanced game, I think that would take more time and effort. It's primarily about having fun and also exploring interesting concepts and learning as much as I can from this.

Sorting your hand

It'd be amazing if I could sort my hand. Either manually (dragging cards) or with a dedicated "sort" button.

Bot doesn't play multiple cards

The bot currently doesn't play multiple cards at all. There should be a random chance of the bot playing multiple cards when possible.

Things to change:

zhithead/src/bot.ts

Lines 8 to 15 in 8399216

if (visibleHand !== undefined) {
const playable = playableCards(pile);
const choice = visibleHand.filter((card) =>
playable.some((playableCard) => getRank(playableCard) === getRank(card))
);
if (!choice.length) return;
return choice[Math.floor(Math.random() * choice.length)];
}

Return an amount of cards when possible at a random chance.

if (e.type === "ASK_PICK_CARD") {
id = delayedTimeout(MIN_DELAY, MAX_DELAY, () =>
callback({
type: "CARD_CHOSEN",
card: bot(e.pile, e.player),
n: undefined,
})
);
}

Use that value returned by the bot function and pass it to the state machine.

Potential missing rule: early pick-up of pile

Loving your work so far! It's a really smooth experience and great fun to play around with.

I'm not sure if this is an official rule, but I've always played with the ability to pick up the pile at will, rather than having to play through until you can't play any more cards.

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.