Home    LittleBigPlanet 1 - PSP - Tearaway -Run Sackboy Run    LittleBigPlanet 1    [LBP1] Help! [Archive]
#1

Finding an average of a set of numbers

Archive: 8 posts


Hi all,

First time poster here. I'm looking for a bit of help with a project I'm working on...

I'm creating an adaption of the Deal or No Deal (http://en.wikipedia.org/wiki/Deal_or_No_Deal) gameshow. I have most of the design working, but am having trouble with a specific part.

Background:
The show's gameplay involves a series of briefcases, each of which contains a different prize value. The user chooses their own briefcase, and then opens up the remaining briefcases. Every time a briefcase is open, the value which was inside that briefcase gets eliminated from the board. At certian stages throughout the game the user is offered a 'deal', whereby they can choose to accept a monetary offer (based on a mean of the remaining case values), or continue opening briefcases.

What I have so far:
- System to randomise the prize values going into each case
- System to recognise which briefcase the user wants to open
- System to read the prize value of an opened briefcase and to eliminate that value from the board

What I'm stuck on:
- I need a way of calculating the bank's offers at certain points throughout the game. The bank offer needs to be related to (although not necessary exactly) the mean of the remaining case values.


Details:
I have 24 prize values, ranging from 1 to 500. Full list of prize values is included below...


PrizeID Value
=================
A 1
B 2
C 3
D 4
E 5
F 6
G 7
H 8
I 9
J 10
K 20
L 30
M 40
N 50
O 60
P 70
Q 80
R 90
S 100
T 150
U 200
V 300
W 400
X 500

There are 8 instances when I need to calculate the average of the remaining/un-opened case values. Details of each instance is given below.

Cases opened Cases remaining
since last
offer
================================
6 18
5 13
4 9
3 6
2 4
1 3
1 2
1 1


So yeah. For the first bank offer, I need a system which can estimate the average of 18 case values, where the cases potentially add up to a total of 2124. :eek:

I'll add details for my latest attempt in a little bit, but does anyone have any ideas of how to tackle this?
2010-07-01 18:40:00

Author:
Tntnnbltn
Posts: 10


Okay, here's what I've come up with so far...

There appears to be two main ways of going about this:


Method 1) Find the sum of the remaining cases and then divide by the number of cases remaining.

For example, I have a bank offer when there are six cases remaining (case values: 6, 50, 80, 90, 200, 500)

Sum of remaining cases = 926
Remaining cases / number of cases = 926 / 6 = 154.3


Method 2) Find out how much each case is worth as part of the offer (value/number of cases), and then find the sum of these values. (Opposite way around to Method 1)

For example, I have a bank offer when there are six cases remaining (case values: 6, 50, 80, 90, 200, 500)

Value for each case: 6/6=1, 50/6=8.3, 80/6=13.3, 90/6=15, 200/6=33.3, 500/6=83.3
Sum of values = 1 + 8.3 + 13.3 + 15 + 33.3 + 83.3 = 154.3



My latest attempt used the second method. Rather than performing division operations in-game, I precalculated how much each case value would be worth if it were part of an offer.


PrizeID Value (v) v/18 v/13 v/9 v/6 v/4 v/3 v/2 v/1
================================================== ====================================
A 1 | 0 0 0 0 0 0 0 1
B 2 | 0 0 0 0 0 0 1 2
C 3 | 0 0 0 0 0 1 1 3
D 4 | 0 0 0 0 1 1 2 4
E 5 | 0 0 0 0 1 1 2 5
F 6 | 0 0 0 1 1 2 3 6
G 7 | 0 0 0 1 1 2 3 7
H 8 | 0 0 0 1 2 2 4 8
I 9 | 0 0 1 1 2 4 4 9
J 10 | 0 0 1 1 3 3 5 10
K 20 | 1 1 2 2 6 6 10 20
L 30 | 1 2 2 6 6 10 16 30
M 40 | 2 2 5 5 10 12 20 40
N 50 | 3 3 5 8 13 15 25 50
O 60 | 3 5 5 10 15 20 30 60
P 70 | 3 5 8 10 20 23 35 70
Q 80 | 5 5 8 15 20 25 40 80
R 90 | 5 5 10 15 20 30 45 90
S 100 | 5 7 10 15 25 35 50 100
T 150 | 8 10 15 25 35 50 75 150
U 200 | 10 15 20 30 50 60 100 200
V 300 | 15 25 35 50 75 100 150 300
W 400 | 20 30 45 65 100 135 200 400
X 500 | 25 35 55 85 125 165 250 500

Going back to the example before, I would need to find the sum of the v/6 values of each of my cases.


Actual values: 6, 50, 80, 90, 200, 500
v/6 values from table: 1, 8, 15, 15, 30, 85
Sum of v/6 values = 154

Using this method, the task simply becomes a matter of finding the sum of pre-calculated values


With this in mind, I design the following system in my level.

http://imgur.com/zBPxC.jpg

Each column represents a different case value. There are 8 rows of dissolveable blocks -- one row of blocks for each bank offer. The dissolveable blocks contain magnetic keys, which include information about the v/18, v/13, v/9, etc values. At the very bottom is a series of magnetic switches which reads the value of the dissolving block immediately above it.

http://imgur.com/DNEmO.jpg

The bottom row of dissolveable blocks contains the v/18 values. Once the v/18 values have been used to calculate the first bank offer, the bottom row of blocks is dissolved and the v/13 blocks fall onto the detector. Once the v/13 values have been used for the second bank offer, they too are dissolved and the v/9 blocks fall onto the detector.

The white base which holds the detector is also made of dissolving material. Each time a case is opened, the base holding the detector disappears, and the detector falls away. This means that the detector is unable to read values from the v/18, v/13, etc blocks and assumes a value of 0.

Example of apparatus using the same example as before:
http://i47.tinypic.com/oti41z.png

Even though all v/6 values are present in the apparatus, there are no detectors underneath the eighteen already-opened cases. The only values detected by the apparatus would be 1, 8, 15, 15, 30 and 85. The sum of these values would be my average for the unopened cases (154).

What I need to do now is find a way of quickly and reliably adding those numbers together. Any suggestions? Or any other completely different approaches which would be better?
2010-07-01 20:13:00

Author:
Tntnnbltn
Posts: 10


Bravo!
That looks like a lot of thinking and logic used to create something awesome!
2010-07-01 20:32:00

Author:
Unknown User


Well, first let me say "Wow"
That was some impressive thinking.
Second, you could add the numbers together based on a large-block emitter, that emits blocks that are sized accordingly to your numbers 1, 8, 15, 15, 30, and 85. The blocks emit into a large tube, which tallies the heights of the blocks and applies a Magnetic switch at the top height, effectively counting the entire structure and the total bank offer.

I don't know how effective it would be, but that's all I could think of
2010-07-01 20:42:00

Author:
nitewalker11
Posts: 222


Second, you could add the numbers together based on a large-block emitter, that emits blocks that are sized accordingly to your numbers 1, 8, 15, 15, 30, and 85. The blocks emit into a large tube, which tallies the heights of the blocks and applies a Magnetic switch at the top height, effectively counting the entire structure and the total bank offer
I'll try, but I don't know if I'll be able to fit in enough emitters thermometer-wise. Using my current system I'd need 108 emitters (on average, each of the 24 cases needs 4-5 different sized blocks to be able to describe each of the eight possible values)
2010-07-01 21:50:00

Author:
Tntnnbltn
Posts: 10


PM me when you finish. I love Deal or No Deal... LOL2010-07-01 22:36:00

Author:
SledKnight
Posts: 93


Emitting into a column works in theory (and the emitters didn't use up as much heat as I thought they would), but you have to space apart the spawn locations so they don't block each other. As a result, the spawned objects pick up enough velocity falling that they crush lower objects. Also, when you have a *giant* column of objects that have landed on each other they bounce up and down.

I'm just changing the keys on my dissolving blocks so that all of my v/18, v/13, etc values are put out in binary. It will use more switches than my current custom-made system, but maybe I'll be able to adapt someone else's binary equipment.
2010-07-01 23:16:00

Author:
Tntnnbltn
Posts: 10


Thanks for the help, guys. Worked out a solution, and posted it in the objects showcase.

https://lbpcentral.lbp-hub.com/index.php?t=29716-Averaging-a-set-of-numbers
2010-07-03 05:09:00

Author:
Tntnnbltn
Posts: 10


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.