COMP114 - Assessment 2 Semester 2 – 2010 Determining Fair Play in Online Game Applying q-tests Assessment Information Assessment Number 2 Contribution to Overall Mark 20% Submission deadline Friday 19th March 2010 16.00 Relevant Learning Outcomes for this Assessment 1 Awareness of different areas of CS for which experimental methods are relevant. 3 Understanding of the factors involved in constructing experiment settings. 5 Ability objectively to assess, analyse, and present experimental results. Assessment Description – Overview This assessment involves conducting an experiment concerning which (if any) of three very simplified gambling games (according to two different sets of rules) is being conducted “fairly”, i.e. whether the amounts won by the game organisers’ (the “House”) are within a range that would be considered acceptable or whether these are so excessive that there are strong grounds to suspect the game is being conducted unfairly so that the House has an unacceptably high chance of winning. It will involve carrying out the following analysis with data supplied via the source described in the Detailed description. Assessment Description – Details A Java class public class RoulettePlay 1 can be downloaded from the module Web pages. [Note: The source code is not provided (and is not required for this assessment).] You should copy this to a file named RoulettePlay.class in your local filestore. This class provides the outcome that results from two different games each of which use a roulette wheel, i.e. the outcome for each play should be a number between 0 and 36. Players may bet on whether the outcome is a High number (one in the range 19 ≤ k ≤ 36) in which case the player wins the amount they staked (plus their original stake). If the outcome is a low number (in the range 1 ≤ k ≤ 18 or if the outcome is 0) then the House wins. It is assumed that the same amount (£1) is staked on each occasion. The class RouletteP lay contains a single constructor RoulettePlay(int n) This has four fields Name Description private int[] OutcomeA The n outcomes of Game A private int[] OutcomeB The n outcomes of Game B private int[] OutcomeC The n outcomes of Game C private int[] rounds The value of n for this instance. There are four instance methods Name Description public int[] GetOutA() Returns the array of outcomes in n rounds of GameA for this instance. public int[] GetOutB() Returns the array of outcomes in n rounds of GameB for this instance. public int[] GetOutC() Returns the array of outcomes in n rounds of GameC for this instance. This assessment requires you to use the class RouletteP lay to write a Java program IsItaFairGame which carries out the following: 1. Read a value n from the standard input. This value can be an arbitrary integer (> 0) and will correspond to the number of rounds played in each game. 2. Create an instance Games = new RoulettePlay(n) of the class RouletteP lay. 3. Using the data given in Games: a. Determine the amount won by the House with GameA for this in- stance, i.e. for each of the n values of the array returned by GetOutA(): if GetOutA()[k] > 18 then 1 is deducted from the House total for GameA; if GetOutA() ≤ 18 1 is added to the House total for GameA. 2 b. Determine the amount won by the House with GameB for this in- stance, i.e. for each of the n values of the array returned by GetOutB(): if GetOutB()[k] > 18 then 1 is deducted from the House total for GameB; if GetOutB() ≤ 18 1 is added to the House total for GameB. c. Determine the amount won by the House with GameC for this in- stance, i.e. for each of the n values of the array returned by GetOutC(): if GetOutC()[k] > 18 then 1 is deducted from the House total for GameC; if GetOutC() ≤ 18 1 is added to the House total for GameC. 4. Using the values computed in Step 3, ompute the q-test values for each games according to the following choices: UK. In UK (mainland) casinos, the wheel uses a single zero. Under these conditions the expected House win (over n rounds with £1 staked per round) is n/37.0, i.e. the expected number of times 0 occurs. The standard deviation in this case is (6.0×√n)/37.0. IOM In continental casinos and on the Isle of Man, wheels may include an additional 00 (so-called “double zero”) which increases the House chance of winning. In this case the expected House win is n/19.0 (House wins outright on 2 of the 38 possibilities) and the standard deviation is ( √ 18.0× n/19.0. Recall from the lectures that the q-test value is |Actual amount won – Expected amount| Standard deviation What should be Submitted a. The source code of the single Java program carrying out the q-test exper- iments described. b. Three tables of results reporting the outcome of the experiments. This table should be structured as below (where X is one of A, B, or C): n Expected Win GameX Win q-test (UK) q-test (IOM) Fair (UK)? Fair (IOM)? 250 ??? ??? ??? ??? Yes/No Yes/No 500 ??? ??? ??? ??? Yes/No Yes/No 750 ??? ??? ??? ??? Yes/No Yes/No 1000 ??? ??? ??? ??? Yes/No Yes/No c. A summary of your conclusions from the experiment which should include a comment on the significance levels with which your conclusions as to a Game’s fairness (or otherwise) is arrived at. d. A completed and signed Declaration On Plagiarism and Collusion Form. 3 How the work should be submitted Items (a–d) should be handed in to the Student Office. A cover sheet should indicate all of the following information: a. The Assessment number. b. Your name and University e-mail address c. Your lab group. d. The name of the demonstrator responsible for this group. e. Your degree programme, e.g. G400 Computer Science, G500 Computer INformation Systems. 4