PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa  >  Odds algorithm  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Odds algorithm
Implementation of the Thomas Bruss odds algorithm
Author: By
Last change: I can't upload PDF document, so I just make theory link refer to the source document on the web :(
Date: 16 years ago
Size: 3,674 bytes


Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="keywords" content="xhtml, css, html, printing, template" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Oods Algorithm</title>


<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />
<div class="tabArea" align="center">
  <a class="tab" href="example.php">Example</a>
  <a class="tab" href="source.php">Class</a>
  <a class="tab" href="" target="_blank">Theory</a>

<div class="Paragraph">

<h2> The good reasoned choice...</h2><br />

<div class="img-shadow">
<img src="images/thumb.png" alt="Khaled Al-Sham'aa" border="0" width="200" height="150" />
<span class="FirstChar">H</span>ow to make the good decision? A mathematical method of simple
formulation and easy application allows us to optimize our choices, in the everyday life as at
the time of serious conflicts.
The problem is defined as a dynamic process that includes two decision makers (DMs) in the selection
of the same offer. A sequence of a prefixed number of (n) offers is observed, one at a time, randomly.
The arrival of offers does not follow any probability distribution. Hence, each DM should rank the
currently observed offers among those already observed. Two kinds of ranks follow: relative and absolute ranks.
At each stage of the dynamic process, an offer can be accepted or discarded.
Each discarded offer cannot be re-examined in later stages. We assume that each DM
has his individual utility and ranking for the selected offer. Since the rankings of
the DMs are different, a conflict can arise when an offer is accepted by either DM and
refused by his opponent. In this case, a stopping rule should be defined in order to avoid such situations.

<h2>Example Game Rules</h2>
Numbers are generated by sequences of random produced by independent draws from a given
range (between 1 and 6 in this example). The law of drawing different numbers or expressions
may be time-invariant (stationary) or else depend on time. For a fixed n (in this case n=12 available events)
and a given pattern (here we are looking for appearance of number 6) our goal is to maximize the probability
of stopping on the k(th) last appearance of number 6 (if any) in such events of total n, given that we must
not return on a previous appearance of 6.


$x = new Oods(12, '1/6');

$i=1; $i<=12; $i++){
ceil(rand(0, 6)) == 6){ $good=true; }else{ $good=false; }

$accept, $w) = $x->doYouAccept();

$accept == true && !$select){
$select = true;
$chance = round($w*100, 0);
"<li><b><font color='blue'>Accept in turn k=$i where chance to be the last appearance of number 6 is %$chance</font></b></li>";
$good && !$select) echo "<li><font color='green'>Number 6 has been appeared at turn k=$i, but we may get better!!</font></li>";
$good && $select) echo "<li><font color='red'>Number 6 has been appeared again at turn k=$i ... we miss it :(</font></li>";

$select) echo "<font color='red'>I am sorry, we loss all our chances!!</font><br />";

<center><a href="example.php">Try Again :o)</a></center>
</div><br /></div></body></html>

For more information send a message to info at phpclasses dot org.