Coder Social home page Coder Social logo

Comments (12)

shivamsaboo17 avatar shivamsaboo17 commented on May 25, 2024 2

I know, haha, maybe we can find S/L ratio for about a million gamers and estimate the probability of a user getting bitten by the snake even before he plays the game.

from asobimasu.

Monal5031 avatar Monal5031 commented on May 25, 2024 1

from asobimasu.

shivamsaboo17 avatar shivamsaboo17 commented on May 25, 2024

@DipanshKhandelwal check out this simulation for S n L in Java. Feel free to make any changes.
https://gist.github.com/shivamsaboo17/9b3ac74d42f96477389d5f6269a1eabd

from asobimasu.

Monal5031 avatar Monal5031 commented on May 25, 2024

@shivamsaboo17 The implementation is pretty much like 2 players racing, you forgot to add the main logic for snake and ladder i.e. if the new rolled position coincides with a snake or ladder and the dice rolling part too 😛

from asobimasu.

shivamsaboo17 avatar shivamsaboo17 commented on May 25, 2024

@Monal5031 did that now. I am also keeping count of snakes and ladders the player encounters. Feel free to add a map that can also keep track of indices but that won't help in gameplay though.
Also, the dice rolling would be the part of layout i.e if the user presses a button, then generate a random number. Also, the switching of players is part of GUI i.e when the user press button we can keep a modulo or something to rotate their turns.

from asobimasu.

Monal5031 avatar Monal5031 commented on May 25, 2024

Like in Tic Tac Toe we keep track of which button is being pressed incrementally and turn on/off (i.e. perform logic), likewise when the roll button will be pressed we'll be needing a logic to roll the dice too.
PS: I was asking for logic when a user steps on ladder i.e. we have to set the new position accordingly which is still not there, you added a count which is redundant.

from asobimasu.

shivamsaboo17 avatar shivamsaboo17 commented on May 25, 2024

@Monal5031 done. Please check.

from asobimasu.

shivamsaboo17 avatar shivamsaboo17 commented on May 25, 2024

@Monal5031 new position was already set before I made the counter update please check. I had updated player's position according to if the value is present in dictionary or not.

That was already done before man ... sigh.

check line 44. was already there before.

Even I thought the idea of adding count was hilarious but then I thought you wanted it for stats or something.

from asobimasu.

Monal5031 avatar Monal5031 commented on May 25, 2024

No I get it nice work 👍 , though the counting the ladder and snakes wouldn't be much of use.

from asobimasu.

DipanshKhandelwal avatar DipanshKhandelwal commented on May 25, 2024

Nice work @shivamsaboo17 .
May be we can just display the encountered number of snakes and ladders at the end of the game.

from asobimasu.

DipanshKhandelwal avatar DipanshKhandelwal commented on May 25, 2024

@shivamsaboo17 , can you make the snakes and ladders that are generated to be different all the time?
This way it would be better as we will get a different board every time we play.

from asobimasu.

shivamsaboo17 avatar shivamsaboo17 commented on May 25, 2024

Ok will do it soon

from asobimasu.

Related Issues (7)

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.