Comments (12)
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.
from asobimasu.
@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.
@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.
@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.
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.
@Monal5031 done. Please check.
from asobimasu.
@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.
No I get it nice work
from asobimasu.
Nice work @shivamsaboo17 .
May be we can just display the encountered number of snakes and ladders at the end of the game.
from asobimasu.
@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.
Ok will do it soon
from asobimasu.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asobimasu.