Search Results

Search found 105 results on 5 pages for 'odds'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • Odds For Fighting Game

    - by thinkfuture
    I'm creating a fighting game where two opponents face off against each other in the ring. While I've been able to figure out the odds of a player winning based on previous wins/losses, I have yet to find a formula which modifies those odds based on opponent. For example: Player 1: W:5 L:5 - 1/1 odds Player 2: W:5 L:0 - 1/5 odds I want to calculate the odds that Player 1 will wins against player 2. Compounding this the players could be of different levels: if the players are within a few levels of each other, the odds should map closely to wins/losses. However, as the levels diverge, the odds of the lower level player winning reduce. As a swag: Player 1 - W:5 L:5 - 1:1 odds Against a level 8 - 1:2 Against a level 9 - 2:3 Against a level 10 - 1:1 Against a level 11 - 3:2 Against a level 12 - 2:1 These are just estimates, my sense is that there is a math formula out there which will calculate that - can anyone out there point me to what this could be? Thanks...Chris

    Read the article

  • Calculating odds distribution with 6-sided dice

    - by Stephen
    I'm trying to calculate the odds distribution of a changing number of 6-sided die rolls. For example, 3d6 ranges from 3 to 18 as follows: 3:1, 4:3, 5:6, 6:10, 7:15, 8:21, 9:25, 10:27, 11:27, 12:25, 13:21, 14:15, 15:10, 16:6, 17:3, 18:1 I wrote this php program to calculate it: function distributionCalc($numberDice,$sides=6) { for ( $i=0; $i<pow($sides,$numberDice); $i++) { $sum=0; for ($j=0; $j<$numberDice; $j++) { $sum+=(1+(floor($i/pow($sides,$j))) % $sides); } $distribution[$sum]++; } return $distribution; } The inner $j for-loop uses the magic of the floor and modulus functions to create a base-6 counting sequence with the number of digits being the number of dice, so 3d6 would count as: 111,112,113,114,115,116,121,122,123,124,125,126,131,etc. The function takes the sum of each, so it would read as: 3,4,5,6,7,8,4,5,6,7,8,9,5,etc. It plows through all 3^6 possible results and adds 1 to the corresponding slot in the $distribution array between 3 and 18. Pretty straightforward. However, it only works until about 8d6, afterward i get server time-outs because it's now doing billions of calculations. But I don't think it's necessary because die probability follows a sweet bell-curve distribution. I'm wondering if there's a way to skip the number crunching and go straight to the curve itself. Is there a way to do this, so, for example, with 80d6 (80-480)? Can the distribution be projected without doing 6^80 calculations? I'm not a professional coder and probability is still new to me, so thanks for all the help! Stephen

    Read the article

  • SET game odds simulation (MATLAB)

    - by yuk
    Here is an interesting problem for your weekend. :) I recently find the great card came - SET. Briefly, there are 81 cards with the four features: symbol (oval, squiggle or diamond), color (red, purple or green), number (one, two or three) or shading (solid, striped or open). The task is to find (from selected 12 cards) a SET of 3 cards, in which each of the four features is either all the same on each card or all different on each card (no 2+1 combination). In my free time I've decided to code it in MATLAB to find a solution and to estimate odds of having a set in randomly selected cards. Here is the code: %% initialization K = 12; % cards to draw NF = 4; % number of features (usually 3 or 4) setallcards = unique(nchoosek(repmat(1:3,1,NF),NF),'rows'); % all cards: rows - cards, columns - features setallcomb = nchoosek(1:K,3); % index of all combinations of K cards by 3 %% test tic NIter=1e2; % number of test iterations setexists = 0; % test results holder % C = progress('init'); % if you have progress function from FileExchange for d = 1:NIter % C = progress(C,d/NIter); % cards for current test setdrawncardidx = randi(size(setallcards,1),K,1); setdrawncards = setallcards(setdrawncardidx,:); % find all sets in current test iteration for setcombidx = 1:size(setallcomb,1) setcomb = setdrawncards(setallcomb(setcombidx,:),:); if all(arrayfun(@(x) numel(unique(setcomb(:,x))), 1:NF)~=2) % test one combination setexists = setexists + 1; break % to find only the first set end end end fprintf('Set:NoSet = %g:%g = %g:1\n', setexists, NIter-setexists, setexists/(NIter-setexists)) toc 100-1000 iterations are fast, but be careful with more. One million iterations takes about 15 hours on my home computer. Anyway, with 12 cards and 4 features I've got around 13:1 of having a set. This is actually a problem. The instruction book said this number should be 33:1. And it was recently confirmed by Peter Norvig. He provides the Python code, but I didn't test it. So can you find an error?

    Read the article

  • Get the highest odds from the last update

    - by Frankie Yale
    I have these tables in a PostgreSQL database: bookmakers ----------------------- | id | name | ----------------------- | 1 | Unibet | ----------------------- | 2 | 888 | ----------------------- odds --------------------------------------------------------------------- | id | odds_type | odds_index | bookmaker_id | created_at | --------------------------------------------------------------------- | 1 | 1 | 1.55 | 1 | 2012-06-02 10:30 | --------------------------------------------------------------------- | 2 | 2 | 3.22 | 2 | 2012-06-02 10:30 | --------------------------------------------------------------------- | 3 | X | 3.00 | 1 | 2012-06-02 10:30 | --------------------------------------------------------------------- | 4 | 2 | 1.25 | 1 | 2012-05-27 09:30 | --------------------------------------------------------------------- | 5 | 1 | 2.30 | 2 | 2012-05-27 09:30 | --------------------------------------------------------------------- | 6 | X | 2.00 | 2 | 2012-05-27 09:30 | --------------------------------------------------------------------- What I am trying to query is the following: Give me the 1/X/2 odds from the latest update (created_at) from ALL bookmakers and from that last update, give me the highest odds for each odds_type ('1', '2', 'X'). On my website I display them as: Best odds right now: 1 | X | 2 -------------------- 2.30 | 3.00 | 3.22 I have to first get the latest, because the odds from the update from yesterday are no longer valid. Then from that last update, I have - in this case - 2 odds from 2 different bookmakers, so I need to get the best one for type '1','2','X'. Pseudo SQL would be something like: SELECT MAX(odds_index) WHERE odds_type = '1' ORDER BY created_at DESC, odds_index DESC But that doesn't work, because I would always get the latest odds (and not the highest/best from those latest) I hope I'm making sense.

    Read the article

  • Will apple allow an odds application?

    - by Paul Peelen
    Hi, This is a hypothetical question. If one would develop an iPhone/iPad (Universal) odds application, whould apple allow this to the appstore? This application would not let you bet on odds directly, but would collect odds from different odds sites and show them to the user. The user can launch these sites and make their bets there (not using the application). Any thought on Apple's "feelings" towards that idea? Best regards, Paul Peelen

    Read the article

  • Algorithm to increase odds of matching when randomly selecting

    - by Bryan
    I am building a mobile game loosely based on dual n-back http://brainworkshop.sourceforge.net/tutorial.html Now with the game I have 9 squares (numbered 1 through 9) and 9 letters (A through K) In the current code, I randomly select a square (e.g. 3) and a letter (e.g. C), then repeat the random selection for the next turn. For 1-back, I test whether either, neither or both match the previous turn. The problem with my current code is I get very few matches - I can go through many turns without having either match. How can I increase the match frequency, or alternatively decrease the randomness so a match is more likely? I am not looking for specific code (but pseudo-code would be fine) - just more an approach to increase match frequency.

    Read the article

  • Better, simpler example of 'semantic conflict'?

    - by rhubbarb
    I like to distinguish three different types of conflict from a version control system (VCS): textual syntactic semantic A textual conflict is one that is detected by the merge or update process. This is flagged by the system. A commit of the result is not permitted by the VCS until the conflict is resolved. A syntactic conflict is not flagged by the VCS, but the result will not compile. Therefore this should also be picked up by even a slightly careful programmer. (A simple example might be a variable rename by Left and some added lines using that variable by Right. The merge will probably have an unresolved symbol. Alternatively, this might introduce a semantic conflict by variable hiding.) Finally, a semantic conflict is not flagged by the VCS, the result compiles, but the code may have problems running. In mild cases, incorrect results are produced. In severe cases, a crash could be introduced. Even these should be detected before commit by a very careful programmer, through either code review or unit testing. My example of a semantic conflict uses SVN (Subversion) and C++, but those choices are not really relevant to the essence of the question. The base code is: int i = 0; int odds = 0; while (i < 10) { if ((i & 1) != 0) { odds *= 10; odds += i; } // next ++ i; } assert (odds == 13579) The Left (L) and Right (R) changes are as follows. Left's 'optimisation' (changing the values the loop variable takes): int i = 1; // L int odds = 0; while (i < 10) { if ((i & 1) != 0) { odds *= 10; odds += i; } // next i += 2; // L } assert (odds == 13579) Right's 'optimisation' (changing how the loop variable is used): int i = 0; int odds = 0; while (i < 5) // R { odds *= 10; odds += 2 * i + 1; // R // next ++ i; } assert (odds == 13579) This is the result of a merge or update, and is not detected by SVN (which is correct behaviour for the VCS). int i = 1; // L int odds = 0; while (i < 5) // R { odds *= 10; odds += 2 * i + 1; // R // next i += 2; // L } assert (odds == 13579) The assert fails because odds is 37. So my question is as follows. Is there a simpler example than this? Is there a simple example where the compiled executable has a new crash? As a secondary question, are there cases of this that you have encountered in real code? Again, simple examples are especially welcome.

    Read the article

  • Select random row from MySQL (with probability)

    - by James Simpson
    I have a MySQL table that has a row called cur_odds which is a percent number with the percent probability that that row will get selected. How do I make a query that will actually select the rows in approximately that frequency when you run through 100 queries for example? I tried the following, but a row that has a probability of 0.35 ends up getting selected around 60-70% of the time. SELECT * FROM table ORDER BY RAND()*cur_odds DESC

    Read the article

  • What approaches can I take to lower the odds of introducing new bugs in a complex legacy app?

    - by m.edmondson
    Where I work I often have to develop (and bug fix) in an old system (.NET 1) whos code is complete spaghetti - with little thought given to variable names, program structure nor comments. Because of this it takes me ages to understand what bits need changed, and I often 'break' the existing software because I've made a modification. I really really want to spend a couple of months (with colleagues) going through it to refactor but existing developers both can't see the need - nor think theres time for this (the system is massive). I dread having to work on its code as it takes days to fix something only to find out I've broken something else. This obviously makes me look incompetent - so how can I deal with this?

    Read the article

  • Aren't Information Expert / Tell Don't Ask at odds with Single Responsibility Principle?

    - by moffdub
    It is probably just me, which is why I'm asking the question. Information Expert, Tell Don't Ask, and SRP are often mentioned together as best practices. But I think they are at odds. Here is what I'm talking about: Code that favors SRP but violates Tell Don't Ask, Info Expert: Customer bob = ...; // TransferObjectFactory has to use Customer's accessors to do its work, // violates Tell Don't Ask CustomerDTO dto = TransferObjectFactory.createFrom(bob); Code that favors Tell Don't Ask / Info Expert but violates SRP: Customer bob = ...; // Now Customer is doing more than just representing the domain concept of Customer, // violates SRP CustomerDTO dto = bob.toDTO(); If they are indeed at odds, that's a vindication of my OCD. Otherwise, please fill me in on how these practices can co-exist peacefully. Thank you. Edit: someone wants a definition of the terms - Information Expert: objects that have the data needed for the operation should host the operation Tell Don't Ask: don't ask objects for data in order to do work; tell the objects to do the work Single Responsibility Principle: each object should have a narrowly defined responsibility

    Read the article

  • Select a random row from table, but with odds?

    - by Don
    I have a table that describes a variety of objects in my system (ie. umbrella, boots, satchel, whatever). Each one of these objects needs to have a distinct prevalence or incidence. For example, the umbrella is rarer than the boots. Based on those factors, I need to randomly select a single object (including a blank or 'no object found') based on that incidence value. Yikes. Make sense?

    Read the article

  • Information Gain and Entropy

    - by dhorn
    I recently read this question regarding information gain and entropy. I think I have a semi-decent grasp on the main idea, but I'm curious as what to do with situations such as follows: If we have a bag of 7 coins, 1 of which is heavier than the others, and 1 of which is lighter than the others, and we know the heavier coin + the lighter coin is the same as 2 normal coins, what is the information gain associated with picking two random coins and weighing them against each other? Our goal here is to identify the two odd coins. I've been thinking this problem over for a while, and can't frame it correctly in a decision tree, or any other way for that matter. Any help? EDIT: I understand the formula for entropy and the formula for information gain. What I don't understand is how to frame this problem in a decision tree format. EDIT 2: Here is where I'm at so far: Assuming we pick two coins and they both end up weighing the same, we can assume our new chances of picking H+L come out to 1/5 * 1/4 = 1/20 , easy enough. Assuming we pick two coins and the left side is heavier. There are three different cases where this can occur: HM: Which gives us 1/2 chance of picking H and a 1/4 chance of picking L: 1/8 HL: 1/2 chance of picking high, 1/1 chance of picking low: 1/1 ML: 1/2 chance of picking low, 1/4 chance of picking high: 1/8 However, the odds of us picking HM are 1/7 * 5/6 which is 5/42 The odds of us picking HL are 1/7 * 1/6 which is 1/42 And the odds of us picking ML are 1/7 * 5/6 which is 5/42 If we weight the overall probabilities with these odds, we are given: (1/8) * (5/42) + (1/1) * (1/42) + (1/8) * (5/42) = 3/56. The same holds true for option B. option A = 3/56 option B = 3/56 option C = 1/20 However, option C should be weighted heavier because there is a 5/7 * 4/6 chance to pick two mediums. So I'm assuming from here I weight THOSE odds. I am pretty sure I've messed up somewhere along the way, but I think I'm on the right path! EDIT 3: More stuff. Assuming the scale is unbalanced, the odds are (10/11) that only one of the coins is the H or L coin, and (1/11) that both coins are H/L Therefore we can conclude: (10 / 11) * (1/2 * 1/5) and (1 / 11) * (1/2) EDIT 4: Going to go ahead and say that it is a total 4/42 increase.

    Read the article

  • Does isEmpty method in Stream evaluate the whole Stream?

    - by abhin4v
    In Scala, does calling isEmtpy method on an instance of Stream class cause the stream to be evaluated completely? My code is like this: import Stream.cons private val odds: Stream[Int] = cons(3, odds.map(_ + 2)) private val primes: Stream[Int] = cons(2, odds filter isPrime) private def isPrime(n: Int): Boolean = n match { case 1 => false case 2 => true case 3 => true case 5 => true case 7 => true case x if n % 3 == 0 => false case x if n % 5 == 0 => false case x if n % 7 == 0 => false case x if (x + 1) % 6 == 0 || (x - 1) % 6 == 0 => true case x => primeDivisors(x) isEmpty } import Math.{sqrt, ceil} private def primeDivisors(n: Int) = primes takeWhile { _ <= ceil(sqrt(n))} filter {n % _ == 0 } So, does the call to isEmpty on the line case x => primeDivisors(x) isEmpty cause all the prime divisors to be evaluated or only the first one?

    Read the article

  • How reliable is HDD SMART data?

    - by andahlst
    Based on SMART data, you can judge the health of a disk, at least that is the idea. If I, for instance, run sudo smartctl -H /dev/sda on my ArchLinux laptop, it says that the hard drive passed the self tests and that it should be "healthy" based on this. My question is how reliable this information is, or more specifically: If according to the SMART data this disk is healthy, what are the odds of the disk suddenly failing despite this? This assumes the failure is not due to some catastrophic event that impossibly could have been predicted, such as the laptop falling down on the floor causing the drive heads to hit the disk. If the SMART data does not say the disk is in good shape, what are the odds of the disk failing within some amount of time? Is it possible that there will be false positives and how common are these? Of course, I keep backups no matter what. I am mostly curious.

    Read the article

  • how to use random bits to simulate a fair 26-sided die?

    - by Michael Levin
    How do I use a random number generator that gives bits (0 or 1) to simulate a fair 26-sided die? I want to use a bitstream to pick letters of the English alphabet such that the odds of any one letter coming up is the same as the odds of any other letter (I know real words aren't like that and have specific frequency distributions for each letter but it doesn't matter here). What's the best way to use binary 0/1 decisions to pick letters fairly from the set A-Z? I can think of a few ways to map bits onto letters but it's not obvious to me that they won't be biased. Is there a known good way?

    Read the article

  • How to convert the output of an artificial neural network into probabilities?

    - by Mathieu Pagé
    I've read about neural network a little while ago and I understand how an ANN (especially a multilayer perceptron that learns via backpropagation) can learn to classify an event as true or false. I think there are two ways : 1) You get one output neuron. It it's value is 0.5 the events is likely true, if it's value is <=0.5 the event is likely to be false. 2) You get two output neurons, if the value of the first is than the value of the second the event is likely true and vice versa. In these case, the ANN tells you if an event is likely true or likely false. It does not tell how likely it is. Is there a way to convert this value to some odds or to directly get odds out of the ANN. I'd like to get an output like "The event has a 84% probability to be true"

    Read the article

  • Bulk-Batch Email From Microsoft Access

    If your users collect email addresses in a database, odds are before long, someone's going to get it into their head to send out an email "blast" or batch. There are several approaches, but what you really need is an engine to send individualized emails, one at a time...

    Read the article

  • Did You Know Gaming Delves into the Mario Universe [Video]

    - by Jason Fitzpatrick
    If you thought you knew everything there was to know about the Mario franchise, prepare to be surprised by the odd and expansive trivia dug up by Did You Know Gaming. Who knew you could learn so much about a game by picking through the game code for odds and ends? If you enjoyed the above video, make sure to check out Part II here. [via Geeks Are Sexy] 7 Ways To Free Up Hard Disk Space On Windows HTG Explains: How System Restore Works in Windows HTG Explains: How Antivirus Software Works

    Read the article

  • Backing up Exchange 2010 For Free

    It's hardly surprising that many SysAdmins are willing to pay over the odds for sophisticated backup solutions which they don't necessarily need, just to make sure their data is safe ASAP. Thankfully, Antoine Khater is here to give you a short and sweet walkthrough on how to keep your Exchange 2010 Server backed up for free. And the best news? You've already got everything you need.

    Read the article

  • Python - Why use anything other than uuid4() for unique strings?

    - by orokusaki
    I see quit a few implementations of unique string generation for things like uploaded image names, session IDs, et al, and many of them employ the usage of hashes like SHA1, or others. I'm not questioning the legitimacy of using custom methods like this, but rather just the reason. If I want a unique string, I just say this: >>> import uuid >>> uuid.uuid4() 07033084-5cfd-4812-90a4-e4d24ffb6e3d And I'm done with it. I wasn't very trusting before I read up on uuid, so I did this: >>> import uuid >>> s = set() >>> for i in range(5000000): # That's 5 million! >>> s.add(uuid.uuid4()) ... ... >>> len(s) 5000000 Not one repeater (I didn't expect one considering the odds are like 1.108e+50, but it's comforting to see it in action). You could even half the odds by just making your string by combining 2 uuid4()s. So, with that said, why do people spend time on random() and other stuff for unique strings, etc? Is there an important security issue or other regarding uuid?

    Read the article

  • Newb Question: scanf() in C

    - by riemannliness
    So I started learning C today, and as an exercise i was told to write a program that asks the user for numbers until they type a 0, then adds the even ones and the odd ones together. Here is is (don't laugh at my bad style): #include <stdio.h>; int main() { int esum = 0, osum = 0; int n, mod; puts("Please enter some numbers, 0 to terminate:"); scanf("%d", &n); while (n != 0) { mod = n % 2; switch(mod) { case 0: esum += n; break; case 1: osum += n; } scanf("%d", &n); } printf("The sum of evens:%d,\t The sum of odds:%d", esum, osum); return 0; } My question concerns the mechanics of the scanf() function. It seems that when you enter several numbers at once separated by spaces (eg. 1 22 34 2 8), the scanf() function somehow remembers each distinct numbers in the line, and steps through the while loop for each one respectively. Why/how does this happen? Example interaction within command prompt: - Please enter some numbers, 0 to terminate: 42 8 77 23 11 (enter) 0 (enter) - The sum of evens:50, The sum of odds:111 I'm running the program through the command prompt, it's compiled for win32 platforms with visual studio.

    Read the article

  • Effecient organization of spare cables and hardware

    - by Jake Wharton
    As many of you also likely do, I have a growing collection of cables, hardware, and spare parts (screws, connectors, etc.). I'm looking to find a good system of organization so that everything isn't a tangled mess, mismatched, and potentially able to be damaged. Since the the three things listed above are all have varying sizes and degrees of delicacy this poises an interesting problem. Presently I have those cheap plastic storage bins you find at Wal-mart for everything. Cables that were once wrapped neatly have become tangled due to numerous "I know I have a cable for this" moments. Hardware is mixed in other bins with odds and ends with no protection from each other. NICs, CPUs, and HDDs are all interacting and likely causing damage. Finally there are stray parts sprinkled amongst these two both in plastic bags and loose. I'm looking to unify this storage into a controlled chaos. Here are my thoughts: Odds and ends are the easiest. Screws, connectors, and small electronic parts lend themselves perfectly to tackle boxes and jewelry boxes. Since these are usually dynamically compartmentalized I can adjust for the contents and label them on the outside or inside of the lid. Cables are easily wrangled with short velcro strips but that doesn't stop them from being all mixed in together. Hardware is the worst offender. Size, shape, and degree of delicacy changes with nearly every piece. I'm willing to sacrifice a bit of organization for a somewhat efficient manner. What are all your thoughts? What is the best type of tackle or jewelry box to use? Most of them are cheap and flimsy. Is there a better alternative? How can I organize cables to know exactly (within reason) where one is? What about associating cables with hardware (Wall adapter to router, etc.)? What kind of storage unit lends itself to all shapes of hardware? Do I need to separate by size or degree of delicacy for better organization?

    Read the article

  • What must one know when approaching web development?

    - by Tal Koren
    I just started working as a novice Web Developer. I know PHP pretty well, as well as some basic jQuery. Anyway, my boss told me I should explore and learn about MVC, Memcache, Design Patterns, how Apache servers work and how to set one up etc. What I want to ask is actually this: What should I learn further? Web Development is a big area and most odds are that I'll never stop learning, but what are the basics I should learn about? What are the fundamentals? Currently I'm focusing on Server Side Development, but a very big part of me also wants to become a front-end ninja, so please consider that in your comments. Thanks in advance, you rock. :)

    Read the article

  • A* Jump Point Search - how does pruning really work?

    - by DeadMG
    I've come across Jump Point Search, and it seems pretty sweet to me. However, I'm unsure as to how their pruning rules actually work. More specifically, in Figure 1, it states that we can immediately prune all grey neighbours as these can be reached optimally from the parent of x without ever going through node x However, this seems somewhat at odds. In the second image, node 5 could be reached by first going through node 7 and skipping x entirely through a symmetrical path- that is, 6 -> x -> 5 seems to be symmetrical to 6 -> 7 -> 5. This would be the same as how node 3 can be reached without going through x in the first image. As such, I don't understand how these two images are not entirely equivalent, and not just rotated versions of each other. Secondly, I'd like to understand how this algorithm could be generalized to a three-dimensional search volume.

    Read the article

1 2 3 4 5  | Next Page >