Recent content by JamesBwoii

  1. J

    MHB Calculating Probability of Winning a Point on Serve in Tennis

    I think I've got it. Is it: Percentage of first serve in * percentage of first serve won + (1-percentage of first serve in) * percentage of second serve won.This seems about right, if you know about tennis it gives the probability of winning a service point of: Djokovic - 69% Isner - 73%...
  2. J

    MHB Calculating Probability of Winning a Point on Serve in Tennis

    Hi, I'm trying to make a tennis betting model but I'm struggling to get my head around how to calculate the probability of a player to win a point when serving. So: How can I calculate the probability, p, of a player winning a point when serving given: The percentage of first serves that the...
  3. J

    MHB Β reduce a redex - Lambda Calculus.

    Thank you, I understand it now. :)
  4. J

    MHB Β reduce a redex - Lambda Calculus.

    As far as I understand it to reduce the formula is: $(\lambda x.M)N -> β M[N\x]$ Where: $β M[N\x]$ means M with every free x replaced by N. I'm stuck on this one though. $(\lambda x. \lambda y.yx)(\lambda x.xy)$ I know that the answer should be $\lambda z.z(\lambda x.xy)$ but I can't get it.
  5. J

    MHB Free variables and binding occurrence of each variable.

    Hi, I'm trying to identify the free variable and binding occurrence but I'm not sure if they're right in lambda calculus. $x$ $\lambda x.x$ $(\lambda a.z)a$ $\lambda a.za$ $(\lambda n.n)z$ $\lambda z.(\lambda y.(\lambda x.x)y)z$ $(\lambda t.((\lambda t.(\lambda t.t)t)t))t$ Then for free...
  6. J

    MHB Generating Solutions for a Challenging Puzzle

    Pretty sure I've figured it out now. S is odd(Goldbach Conjecture). S is not of the form Q+2 where Q is prime. S is less than 55.
  7. J

    MHB Generating Solutions for a Challenging Puzzle

    Hi, I'm doing some programming work with regards to this puzzle. Impossible Puzzle - Wikipedia, the free encyclopedia I have to generating the solutions to the the resulting solutions after the four following sentences are said. P says "I cannot find these numbers." S says "I was sure that...
  8. J

    MHB Implementing mini imperative language in Haskell.

    Ah that's great, no errors from any of that code. I did forget to mention that we'd been given some more skeleton code that we need to complete. If you wouldn't mind helping me out that would be great. I've had a go but am getting a bit stuck. Here it is: ------------------------- Boolean...
  9. J

    MHB Implementing mini imperative language in Haskell.

    Ok, I've been given code for a get function and a set function (which I assume is the same as update?). type Variable = String type State = [(Variable,Integer)] empty :: State empty = [] set :: Variable -> Integer -> State -> State set v n [] = [(v,n)] set v n ((w,m):xs) | v == w = (v,n)...
  10. J

    MHB Implementing mini imperative language in Haskell.

    Not sure why it wasn't given, the specification says - "Complete the data type Aexp for Aexp given in coursework_1.hs, using the constructors Incr and Decr for post-increment and post-decrement. Un- comment factorial and runfactorial, which should pass type-checking." I don't know if it involves...
  11. J

    MHB Implementing mini imperative language in Haskell.

    Hi, I need to implement a mini imperative language in Haskell but I'm struggling to get my head around it. I need to implement an increment and decrement function like ++ and -- in other languages. We've been given some skeleton code which we need to complete in order to run a factorial...
  12. J

    MHB UML class diagram for a system.

    Oh ok that makes sense. Just one quick question, I'm curious as to why the Customer class that I've used is an interface as opposed to an abstract class? Seeing as there are some methods which some customer classes essentially don't use, like IndividualCustomer returning null for discount and...
  13. J

    MHB UML class diagram for a system.

    Ok, I've finished doing the other customer types and it's all working. Just going back through the spec and I read this. "The main focus of your implementation should concentrate upon manipulating a list (or array/vector) of customers." I'm not sure exactly what this means, but this is what...
  14. J

    MHB UML class diagram for a system.

    Perfect! It's working now, just got to do the other types of customers but that should be straight forward, hopefully won't have any more issues. Thanks! :D
  15. J

    MHB UML class diagram for a system.

    Oh of course, thought it was because a discount was never made. This might be stupid but the CorporateDiscount class takes a customer as a parameter, so when I'm creating it the CorporateCustomer's constructor what do I put as the parameter since shouldn't it be the CorporateCustomer itself, if...
Back
Top