����JFIF�����%%��� }!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������� w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|��O�������h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,���|-��v��(���� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�������;~��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@�������?�_�����j������ (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,���|-��v��(���� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�������;~��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@�������?�_�����j������ (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,��������ο�O�P��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������k�w���~���v��������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j�?�5o�%��?��� g����U@�����&O3�����a�;�^=�wH���D��/��*� �fX�I���,������k?g_���?�5o�%��?��� g����U@�F�����������*������?�o�}��Τ~g��ʀ�#V��Y������~ο�T�j��K/� ������������z��������#;�~���A�;��� w�F�����������*���տ��_�@�o��5����EU������������u�誠��W��[�����������O��?jW���@��տ���@�o��5����EM������������v�訠�#V��Y�������������V��Zv��~����vw�~���c�Q@���,��~���kgo���?�5o�%��/��� o����Q@��o�%�>�ߤ���߳����S������?��o�%�~�ߠ�d�߳����S����g�P��j��K?� _������������[� g�D����[�;�TP7���������'Ѿ���=��;/�P��j��K?� _������������[� g�D����[�;�TP���,��~���kgo���a������۔���B{���ea�`T�+ �n%Ц �����j��K?� _������������[� g�D����[�;�TP���,��~���kgo����?���%�/�~�����#����x��c�~�q�v�t`ȫ��_'h���������'�]�;{s� Pp=N= 5���%�����ڜs�����=���J��A@�����Kp�b��}��X�����4g v+:�Բ�+60�ʩ,� @�����������I �uO�����ToUv��bgUl�cP�T?�#V��Y������������j��K?� _����������!��X��]���������TK�|4��`� ��#��P\y��aa >NgL��j��K?� _������������[� g�D����[�;�TP���,��~���kgo���o�F�����$��ہ�� ��vݞr6��S�q''*02���[� g�D����[�;�TP���,��~���kgo���?�5o�%��/��� o����Q@�F�����������*(��տ���@�o��5����EE������������v�訠��������~1�o���}G�L�������5o�%��/��� o����Q@�F�����������*(��տ���@�o��5����EE5����%�˷���r�v����y�\~���)(?0���=[� i����>��gc��N=����5o�%��/��� o����Q@�F�����������*(��W��Z�l����m#���X�wn_�j`0C6윅����5o�%��/��� o����Q@��տ��y9���gbO�G�5@�n�>���#V��Y������~ο�T��V��Y����9�gc��s�T.�?Z_��[� e�D����Y�:��UP���,������k?g_����_�=_� n�~~�rI������w�,"~ԓ�!72���)( u��#V��Y������~ο�T�j��K/� ��������������K
�����Kr_���}�De>~��Z=��pjX�n[p(�"� �a,Ub�/�×�<����;��<�����K>��o���[�:����V���,��$��ϧ�*�����5O����տ��_�@�o��5����EU5��o�%����?�ꜜm�_�;>Gbs�S�����@��տ��_�@�o��5����EU ��տ��}�~�����v?�������-��o�l��~�ȥ�v����r��B1���@��տ���A�?����ggP��c�S�`@%�*����տ��_�@�o��5����EU������������u�誠7���� O���!c�|0��ёv��4�+�X�Vx�RX3��8����K>��o���[�:���u#�x��#V��Y������~ο�T�j��K/� ������������[� e�D����Y�:��UP���,������k?g_���O��[� g�D����[�:��T��=_� k����~��k����c�;����.8����c��z��Ͽ�/��zc�o����F?Z_��[� e�D����Y�:��UP���,������k?g_���C���,�v����v�o���H������(�z���w�/�����v ��T.G��Ϡ���տ��_�@�o��5����EU������������u�誠��W��[��'����%��o���:�Cڕ�R̀���j���������?�o���[�;������g0q�?��o�%�>o�_��>�gf����~4�������������u�誠�z���7�/��o���������_��[� e�D����Y�:��UP���,������k?g_���C���,�|�����o��;�Ԟ��9�l�z��ؠ3|��O�X�~���;~�q����Z�F�����������*���տ��_�@�o��5����EU!��տ��}�~����-��G��I�T�������������u�誠�#V��Y������~ο�T�j��K/� ����������#�=_� n|���KbB�gtdM��"�ڒA#n�63�6�m�P�����,���/���gS�u����#�9��5o�%��?��� g����U@��o�%�o�_�����u��'�������?��o��� ���3��?go���|m�ڇ���-S�O��x��>���^�����7����x�]_�>�qke>���m��4��7P�Yހ��
0byt3m1n1
0byt3m1n1
Path:
/
hermes
/
bosweb
/
web
/
sb_web
/
web
/
web
/
sb_web
/
b2374
/
checkersorwreckers.net
/
[
Home
]
File: GameLogic_20141007.php
<?php include_once('connection.php'); include_once('Library/Common.php'); $invalidIndx = 1; function ComputeWeeklyScore($week, $year, $ViewONLY, $_PICK_TOP_5_IN_CHASE_WEEK, $_ALL_STAR_WEEK, $_CHAMPION_PICK_WEEK, $_CALCULATE_BONUS1_WEEK, $_NUM_RACES_IN_SEASON) { $MAX_DEFAULT_PICKS = 3; $MySQLConnection = ConnString(); echo "Week " . $week . "<br>"; //Get all players and thier picks for a given week. $Players = mysql_query("SELECT * FROM players where isActive='Y' and year=$year", $MySQLConnection); //Loop through each player's picks and calculate their score. while ($Players_row = mysql_fetch_assoc($Players)) { $GLOBALS['invalidIndx'] = 1; $playerid = $Players_row['playerid']; $illegalPicks = false; $useddefault = "N"; if($week != $_ALL_STAR_WEEK) { //Get all players and thier picks for a given week. $PlayersPicks = mysql_query("SELECT * FROM picks where week = $week and playerid = $playerid and islegal='Y' and year=$year", $MySQLConnection); $PlayersPicks_row = mysql_fetch_assoc($PlayersPicks); //zero index is not used in any of the array's below. $CarNum = array(0,0,0,0,0,0); $PointsPos = array(0,0,0,0,0,0); $Invalid = array('N','N','N','N','N','N'); $LastWeekInvalidPicks= ""; $LastWeeksPicks = mysql_query("SELECT * FROM picks where week = $week-1 and playerid = $playerid and islegal='Y' and year=$year", $MySQLConnection); $LastWeeksPicks_row = mysql_fetch_assoc($LastWeeksPicks); $LastWeekInvalidPicks = $LastWeeksPicks_row['invalidpicks']; if ($PlayersPicks_row['pickid'] > 0) { $CarNum[1] = (string)$PlayersPicks_row['pick1']; $CarNum[2] = (string)$PlayersPicks_row['pick2']; $CarNum[3] = (string)$PlayersPicks_row['pick3']; $CarNum[4] = (string)$PlayersPicks_row['pick4']; $CarNum[5] = (string)$PlayersPicks_row['pick5']; //$PlayersRaceWinnerSel = (string)$PlayersPicks_row['racewinner']; //car number of the race winner }else { //Get how many times this player has used the defualt picks $Players_Info = mysql_query("SELECT * FROM playerspoints where playerid = $playerid and year=$year", $MySQLConnection); $PlayersInfo_row = mysql_fetch_assoc($Players_Info); if($PlayersInfo_row['DefaultPicksUsed'] <= 4) { //$MAX_DEFAULT_PICKS) { //give player the default picks echo "Assigning default picks"; SetDefaultPicks($CarNum, $week, $year); $illegalPicks = true; $useddefault = "Y"; }else { //Set default picks to a number which will never result in points. //$CarNum[1] = 0; //$CarNum[2] = 0; //$CarNum[3] = 0; //$CarNum[4] = 0; //$CarNum[5] = 0; echo "Player has exceed allowed number of default picks"; $Invalid[1] = 'Y'; $Invalid[2] = 'Y'; $Invalid[3] = 'Y'; $Invalid[4] = 'Y'; $Invalid[5] = 'Y'; //$PlayersRaceWinnerSel = 3; //car number of the race winner //increase the number of times this player has used the default picks $numTimesPlayerUsedDefaults = $PlayersInfo_row['DefaultPicksUsed'] + 1; $PlayersUpdate = mysql_query("UPDATE playerspoints set DefaultPicksUsed=$numTimesPlayerUsedDefaults where playerid = $playerid and year=$year", $MySQLConnection); $PlayersUpdate_row = mysql_fetch_assoc($PlayersUpdate); } } //Display Players Original Picks echo "<bR><bR>|-----------------------------------|<br>"; $NameFiller = (35 - strlen($Players_row['screenname']))/2; $nFiller = ""; for($t=1; $t<= $NameFiller; $t++) { $nFiller .= " "; } echo $nFiller . "<b><font color='#FF0000'>" . $Players_row['screenname'] . "</font></b>" . $nFiller . "<br>"; echo "|-----------------------------------|<br>"; /*echo "Original Picks<br>"; echo "-------------------------------------<br>"; echo "Pick 1: " . $CarNum[1] . "<br>"; echo "Pick 2: " . $CarNum[2] . "<br>"; echo "Pick 3: " . $CarNum[3] . "<br>"; echo "Pick 4: " . $CarNum[4] . "<br>"; echo "Pick 5: " . $CarNum[5] . "<br><Br>";*/ //Loop through the points standings an determine the current points //Get the points standings for the prev week. helps determine invlaid picks for the given week $PointsStandings = mysql_query("SELECT * FROM pointsstandings where week = $week-1 and Year(createddate) = $year", $MySQLConnection); //$PointsStandings_row = mysql_fetch_assoc($PointsStandings); while ($PointsStandings_row = mysql_fetch_assoc($PointsStandings)) { for($i=1; $i <= 5; $i++) { if(strcmp($CarNum[$i], $PointsStandings_row['car']) == 0 && strlen($CarNum[$i]) == strlen($PointsStandings_row['car'])) { //echo "car picked = " . $CarNum[$i] . "<br>"; $PointsPos[$i] = $PointsStandings_row['rank']; } } } $Picks = array($CarNum, $PointsPos); echo "| <B>Original Picks</b> |<br>"; echo "|-----------------------------------|<br>"; echo "| Pos. | Car # |<br>"; echo "|-----------------------------------|<br>"; for($i=1; $i < sizeof($Picks[0]); $i++) { $Filler1 = " "; $Filler2 = " "; if ( strlen($Picks[1][$i]) == 1) $Filler1 .= " "; if ( strlen($Picks[0][$i]) == 1) $Filler2 .= " "; echo "| " . $Picks[1][$i] . $Filler1 . " | " . $Picks[0][$i] . $Filler2 . " |<br>"; } echo "|-----------------------------------|<br>"; /******************** Validate Picks *********************/ /* This will insure that each player's picks are with the scope of the rules. That is they only have 1 driver in the top 5, 2 from the top 10, 3 from the top 15, 4 from the top 20 and 1 driver 21st or greater. */ //Sort the array by position in ascending order. //array_multisort($Picks[1],SORT_ASC, SORT_NUMERIC); /************************************************* CHECK TO SEE IF ANY PICKS FROM THE CURRENT WEEK WERE USED THE PREVIOUS WEEK. *************************************************/ //echo "<Br>*******************Check Current Picks Against Last Weeks Picks*********************<br>"; $Filler3 = ""; if($week != 1) { if($week != $_CHAMPION_PICK_WEEK) { for($i=1;$i <= 5; $i++) { $CarNumToCheck = $Picks[0][$i]; //echo "checking this car if used last week " . $CarNumToCheck . "<br>"; if(CarUsedLastWeek($week, $playerid, $CarNumToCheck, $year, $_CALCULATE_BONUS1_WEEK) == true && IsCarIllegal($LastWeekInvalidPicks, $CarNumToCheck) != "") { if(strlen($CarNumToCheck) == 1) $Filler3 = " "; echo "| Car # " . $CarNumToCheck . " used last week " . $Filler3 . " |<br>"; $LastWeekInvalidPicks .= "," . $CarNumToCheck; //indicate which car # is invalid $Invalid[$i] = 'Y'; /* $PosIndx = $Picks[1][$i]; //Get points position of the car used last week. //if used then get the next driver in points $FirstValidDriver = FindNextValidDriver($week, $playerid, $PosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); $AlreadyUsed = true; while ($AlreadyUsed == true) { $AlreadyUsed = false; for($v = 1; $v <= 5; $v++) { //echo $ValidInfo[0] . " = " . $Picks[0][$v] . "<bR>"; if(strcmp($ValidInfo[0], $Picks[0][$v]) == 0) { //match found //echo " match found: " . $ValidInfo[0] . " and " . $Picks[0][$v] . "<br>"; $AlreadyUsed = true; } } if ($AlreadyUsed == true) { //Increase the position index by one and get they next valid driver. $PosIndx = $ValidInfo[1]; $PosIndx = $PosIndx + 1; //echo "posindx: " . $PosIndx . "<br>"; $FirstValidDriver = FindNextValidDriver($week, $playerid, $PosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); } } if(strlen($ValidInfo[0]) == 1) $Filler = " "; if(strlen($ValidInfo[1]) == 1) $Filler = " "; echo "| Next valid Car #" . $ValidInfo[0] . " in position " . $ValidInfo[1] . $Filler . " |<br>"; $Picks[0][$i] = (string)$ValidInfo[0]; $Picks[1][$i] = (string)$ValidInfo[1]; MoveValueToEndofArray($Picks, $i); $illegalPicks = true; $i--;*/ } } } /************************************************ Check to make sure the same driver wasn't used multiple times *************************************************/ $Used = array(0,0,0,0,0,0); //track which car numbers have already been used. //for($i=1; $i <= 5; $i++) //{ for($z=1; $z <= 5; $z++) { //if(strcmp($Picks[0][$i], $Picks[0][$z]) == 0) //{ if(DriverAlreadyUsed($Picks[0][$z], $Used)) { //indicate which car # is invalid $Invalid[$z] = 'Y'; /* $PosIndx = $Picks[1][$z]; $PosIndx = $PosIndx + 1; //if used then get the next driver in points $FirstValidDriver = FindNextValidDriver($week, $playerid, $PosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); $Picks[0][$z] = (string)$ValidInfo[0]; $Picks[1][$z] = (string)$ValidInfo[1]; MoveValueToEndofArray($Picks, $z); $illegalPicks = true; $z--; */ } //$Used[$z] = $Picks[0][$z]; } //only if the picks have changed due to illegal picks display the new picks //for the current player if($illegalPicks == true) { echo "|-----------------------------------|<br>"; echo "| Picks After Adjustment for |<br>"; echo "| Same Pick(s) Last Week |<br>"; echo "|-----------------------------------|<br>"; echo "| Pos. | Car # |<br>"; echo "|-----------------------------------|<br>"; for($i=1; $i < sizeof($Picks[0]); $i++) { $Filler1 = " "; $Filler2 = " "; if ( strlen($Picks[1][$i]) == 1) $Filler1 .= " "; if ( strlen($Picks[0][$i]) == 1) $Filler2 .= " "; echo "| " . $Picks[1][$i] . $Filler1 . " | " . $Picks[0][$i] . $Filler2 . " |<br>"; } echo "|-----------------------------------|"; } /************************************ Check to see that the players has the correct number of drivers from each grouping ************************************/ $pos_1to5 = 0; $pos_6to10 = 0; $pos_11to15 = 0; $pos_16to20 = 0; $pos_21to25 = 0; //echo "Invalid Picks: " . $LastWeekInvalidPicks . "<br>"; for($i = 1; $i <= 5 ; $i++) { if( $Picks[1][$i] > 0 && $Picks[1][$i] <= 5 && IsCarIllegal($LastWeekInvalidPicks, $Picks[1][$i]) != "") $pos_1to5 += 1; if( $Picks[1][$i] >= 6 && $Picks[1][$i] <= 10 && IsCarIllegal($LastWeekInvalidPicks, $Picks[1][$i]) != "") $pos_6to10 += 1; if( $Picks[1][$i] >= 11 && $Picks[1][$i] <= 15 && IsCarIllegal($LastWeekInvalidPicks, $Picks[1][$i]) != "") $pos_11to15 += 1; if( $Picks[1][$i] >= 16 && $Picks[1][$i] <= 20 && IsCarIllegal($LastWeekInvalidPicks, $Picks[1][$i]) != "") $pos_16to20 += 1; if( $Picks[1][$i] >= 21 && IsCarIllegal($LastWeekInvalidPicks, $Picks[1][$i]) != "")//&& $Picks[1][$i] <= 25) $pos_21to25 += 1; } //for($i=1; i <= sizeof($Picks); i++) /*echo "Before Adjustments<br>"; echo $pos_1to5 . " between 1-5 <Br>"; echo $pos_6to10 . " between 6-10 <Br>"; echo $pos_11to15 . " between 11-15 <Br>"; echo $pos_16to20 . " between 16-20 <Br>"; echo $pos_21to25 . " between 21 plus <Br><br>";*/ $error = ""; if($pos_1to5 > 1) { /*echo "<br>---------------pos 1-5 adjust----------------------------<br>"; echo $pos_1to5 . " from 1-5<Br>"; echo $pos_6to10 . " from 6-10<Br>"; echo $pos_11to15 . " from 11-15<Br>"; echo $pos_16to20 . " from 16-20<Br>";*/ //multiplie picks in the 1-5 range. $mcount = 0; if($pos_1to5 > 1) { $mcount = 1; } DetermineInvalidPicks($InvalidPicks1, $Picks, 1,5, $mcount); //Display Invaild Picks for($i=1; $i <= sizeof($InvalidPicks1[0]); $i++) { echo $InvalidPicks1[1][$i] . " - invalid pick (index " . $InvalidPicks1[0][$i] . ")<br>"; } $NumberOfReAssignments = 0; for($i = 1; $i <= sizeof($InvalidPicks1[0]); $i++) { //indicate which car # is invalid $Invalid[$InvalidPicks1[0][$i]] = 'Y'; $pos_1to5--; /* REASSIGN DRIVER $illegalPicks = true; $pos_1to5--; //Set the default pos of the first vaild position $driverPosIndx = 0; if($pos_6to10 == 0) { //get driver from pos 6 $driverPosIndx = 6; $pos_6to10 = 1; }else if($pos_11to15 == 0) { //get driver from pos 11 $driverPosIndx = 11; $pos_11to15 = 1; }else if($pos_16to20 == 0) { //get driver from pos 16 $driverPosIndx = 16; $pos_16to20 = 1; }else if($pos_21to25 == 0) { //get driver from pos 21 $driverPosIndx = 21; $pos_21to25 = 1; }else { //get driver from pos 26 $driverPosIndx = 26; } //get driver in pos $driverPosIndx //Checking if the players selected that driver //last week. while the driver in driverPosIndx is invalid //add one to the driverPosIndx. //echo " in here 1a"; $FirstValidDriver = FindNextValidDriver($week, $playerid, $driverPosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); echo "Next valid Driver #" . $ValidInfo[0] . " in position " . $ValidInfo[1] . "<br>"; $indxOfInvalidDriver = $InvalidPicks1[0][$i]; //get the index of the invalid pick in the Picks array $indxOfInvalidDriver -= $NumberOfReAssignments; //Change the users picks to the next valid driver and position $Picks[0][$indxOfInvalidDriver] = (string)$ValidInfo[0];//Car number $Picks[1][$indxOfInvalidDriver] = (string)$ValidInfo[1];//points standings MoveValueToEndofArray($Picks, $indxOfInvalidDriver); $NumberOfReAssignments++; */ } //for($i = 1; $i <= sizeof($InvalidPicks1[0]); $i++) } /* echo "1-5: " . $pos_1to5 . "<br>"; echo "6-10: " . $pos_6to10 . "<br>"; echo "11-15: " . $pos_11to15 . "<br>"; echo "16-20: " . $pos_16to20 . "<br>"; echo "21+: " . $pos_21to25 . "<br><Br>"; */ if($pos_6to10 > 2 || ($pos_1to5 + $pos_6to10 > 2))// || ($pos_11to15 + $pos_1to5 + $pos_6to10) > 3)//($pos_11to15 == 2 && ($pos_1to5 + $pos_6to10) == 2)) { //echo "<br>---------------pos 6-10 adjust-----------------------<br>"; //echo $pos_1to5 . " from 1-5<Br>"; //echo $pos_6to10 . " from 6-10<Br>"; //echo $pos_11to15 . " from 11-15<Br>"; //echo $pos_16to20 . " from 16-20<Br>"; //multiplie picks in the 6-10 range. //$error .= "to many picks in the 6-10 range.<br>"; //Reset golbal index $GLOBALS['invalidIndx'] = 1; $mcount = 0; if($pos_1to5 + $pos_6to10 >= 2) { $mcount = 2; } DetermineInvalidPicks($InvalidPicks2, $Picks, 1,10, $mcount); //Display Invaild Picks for($i=1; $i <= sizeof($InvalidPicks2[0]); $i++) { echo $InvalidPicks2[1][$i] . " - invalid pick (index " . $InvalidPicks2[0][$i] . ")<br>"; } $NumberOfReAssignments = 0; for($i = 1; $i <= sizeof($InvalidPicks2[0]); $i++) { //indicate which car # is invalid $Invalid[$InvalidPicks2[0][$i]] = 'Y'; $pos_6to10--; /*REASSIGN DRIVER $illegalPicks = true; $pos_6to10--; //Set the default pos of the first vaild position $driverPosIndx = 0; if($pos_11to15 == 0) { //get driver from pos 11 $driverPosIndx = 11; $pos_11to15 = 1; }else if($pos_16to20 == 0) { //get driver from pos 16 $driverPosIndx = 16; $pos_16to20 = 1; }else if($pos_21to25 == 0) { //get driver from pos 21 $driverPosIndx = 21; $pos_21to25 = 1; }else { //get driver from pos 26 $driverPosIndx = 26; } //get driver in pos $driverPosIndx //Checking if the players selected that driver //last week. while the driver in driverPosIndx is invalid //add one to the driverPosIndx. //echo " in here"; $FirstValidDriver = FindNextValidDriver($week, $playerid, $driverPosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); echo "Next valid Driver #" . $ValidInfo[0] . " in position " . $ValidInfo[1] . "<br>"; $indxOfInvalidDriver = $InvalidPicks2[0][$i]; //get the index of the invalid pick in the Picks array $indxOfInvalidDriver -= $NumberOfReAssignments; //Change the users picks to the next valid driver and position $Picks[0][$indxOfInvalidDriver] = (string)$ValidInfo[0];//Car number $Picks[1][$indxOfInvalidDriver] = (string)$ValidInfo[1];//points standings MoveValueToEndofArray($Picks, $indxOfInvalidDriver); $NumberOfReAssignments++; */ } //for($i = 1; $i <= sizeof($InvalidPicks2[0]); $i++) } if($pos_11to15 > 3 || ($pos_1to5 + $pos_6to10 + $pos_11to15 > 3)) //|| ($pos_16to20 + $pos_1to5 + $pos_6to10 + $pos_11to15 > 4)) { //multiplie picks in the 11-15 range. //$error .= "to many picks in the 11-15 range.<br>"; /*echo "<br>---------------pos 11-15 adjust-----------------------<br>"; echo $pos_1to5 . " from 1-5<Br>"; echo $pos_6to10 . " from 6-10<Br>"; echo $pos_11to15 . " from 11-15<Br>"; echo $pos_16to20 . " from 16-20<Br>";*/ //multiplie picks in the 6-10 range. //$error .= "to many picks in the 6-10 range.<br>"; //Reset golbal index $GLOBALS['invalidIndx'] = 1; $mcount = 0;//$pos_1to5 + $pos_6to10 + $pos_11to15; if($pos_1to5 + $pos_6to10 + $pos_11to15 >= 3) { $mcount = 3; } DetermineInvalidPicks($InvalidPicks3, $Picks, 1,15, $mcount); //Display Invaild Picks for($i=1; $i <= sizeof($InvalidPicks3[0]); $i++) { echo $InvalidPicks3[1][$i] . " - invalid pick (index " . $InvalidPicks3[0][$i] . ")<br>"; } $NumberOfReAssignments = 0; for($i = 1; $i <= sizeof($InvalidPicks3[0]); $i++) { //indicate which car # is invalid $Invalid[$InvalidPicks3[0][$i]] = 'Y'; $pos_11to15--; /* REASSIGN DRIVER $illegalPicks = true; $pos_11to15--; //Set the default pos of the first vaild position $driverPosIndx = 0; if($pos_16to20 == 0) { //get driver from pos 16 $driverPosIndx = 16; $pos_16to20 = 1; }else if($pos_21to25 == 0) { //get driver from pos 21 $driverPosIndx = 21; $pos_21to25 = 1; }else { //get driver from pos 26 $driverPosIndx = 26; } //get driver in pos $driverPosIndx //Checking if the players selected that driver //last week. while the driver in driverPosIndx is invalid //add one to the driverPosIndx. //echo " in here2"; $FirstValidDriver = FindNextValidDriver($week, $playerid, $driverPosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); echo "Next valid Driver #" . $ValidInfo[0] . " in position " . $ValidInfo[1] . "<br>"; $indxOfInvalidDriver = $InvalidPicks3[0][$i]; //get the index of the invalid pick in the Picks array $indxOfInvalidDriver -= $NumberOfReAssignments; //Change the users picks to the next valid driver and position $Picks[0][$indxOfInvalidDriver] = (string)$ValidInfo[0];//Car number $Picks[1][$indxOfInvalidDriver] = (string)$ValidInfo[1];//points standings MoveValueToEndofArray($Picks, $indxOfInvalidDriver); $NumberOfReAssignments++; */ } //for($i = 1; $i <= sizeof($InvalidPicks3[0]); $i++) } if($pos_16to20 > 4 || ($pos_1to5 + $pos_6to10 + $pos_11to15 + $pos_16to20 > 4)) { /*echo "<br>---------------pos 16-20 adjust-----------------------<br>"; echo $pos_1to5 . " from 1-5<Br>"; echo $pos_6to10 . " from 6-10<Br>"; echo $pos_11to15 . " from 11-15<Br>"; echo $pos_16to20 . " from 16-20<Br>";*/ //multiplie picks in the 16-20 range. //$error .= "to many picks in the 16-20 range.<br>"; //Reset golbal index $GLOBALS['invalidIndx'] = 1; $mcount = 0;//$pos_1to5 + $pos_6to10 + $pos_11to15; if($pos_1to5 + $pos_6to10 + $pos_11to15 + $pos_16to20 >= 4) { $mcount = 4; } else { $mcount = 0; } DetermineInvalidPicks($InvalidPicks4, $Picks, 1,20, $mcount); //Display Invaild Picks for($i=1; $i <= sizeof($InvalidPicks4[0]); $i++) { echo $InvalidPicks4[1][$i] . " - invalid pick (index " . $InvalidPicks4[0][$i] . ")<br>"; } $NumberOfReAssignments = 0; for($i = 1; $i <= sizeof($InvalidPicks4[0]); $i++) { //indicate which car # is invalid $Invalid[$InvalidPicks4[0][$i]] = 'Y'; $pos_16to20--; /*REASSIGN DRIVER $illegalPicks = true; $pos_16to20--; //Set the default pos of the first vaild position $driverPosIndx = 0; if($pos_21to25 == 0) { //get driver from pos 21 $driverPosIndx = 21; $pos_21to25 = 1; }else { //get driver from pos 26 $driverPosIndx = 26; } //get driver in pos $driverPosIndx //Checking if the players selected that driver //last week. while the driver in driverPosIndx is invalid //add one to the driverPosIndx. //echo " in here3"; $FirstValidDriver = FindNextValidDriver($week, $playerid, $driverPosIndx, $year); $ValidInfo = explode(";", $FirstValidDriver); echo "Next valid Driver #" . $ValidInfo[0] . " in position " . $ValidInfo[1] . "<br>"; $indxOfInvalidDriver = $InvalidPicks4[0][$i]; //get the index of the invalid pick in the Picks array $indxOfInvalidDriver -= $NumberOfReAssignments; //Change the users picks to the next valid driver and position $Picks[0][$indxOfInvalidDriver] = (string)$ValidInfo[0];//Car number $Picks[1][$indxOfInvalidDriver] = (string)$ValidInfo[1];//points standings MoveValueToEndofArray($Picks, $indxOfInvalidDriver); $NumberOfReAssignments++; */ } //for($i = 1; $i <= sizeof($InvalidPicks4[0]); $i++) } //if($pos_21plus > 5) //{ //multiplie picks in the 16-20 range. //} if($illegalPicks == true) { echo "<br>|-----------------------------------|<br>"; echo "| <b>Final Picks</b> |<br>"; echo "|-----------------------------------|<br>"; echo "| Pos. | Car # |<br>"; echo "|-----------------------------------|<br>"; for($i=1; $i < sizeof($Picks[0]); $i++) { $Filler1 = " "; $Filler2 = " "; if ( strlen($Picks[1][$i]) == 1) $Filler1 .= " "; if ( strlen($Picks[0][$i]) == 1) $Filler2 .= " "; echo "| " . $Picks[1][$i] . $Filler1 . " | " . $Picks[0][$i] . $Filler2 . " |<br>"; } echo "|-----------------------------------|<br>"; } if($error == "") { //echo "<br>All picks are valid<Br><Br>"; }else { //echo "<br>following error:<br>" . $error . "<br><Br>"; //If an error occured then thier was some invalid picks //adjust the picks so they are legal } } //end if($week != 1) //echo $Players_row['screenname'] . " "; //Now that all of the picks are legal, now we can compute the total score //for the given week. /*********************************************************************************** Check to see if any illegal picks had to be fixed, if so create a new picks record for the current user who made the illegal picks. ************************************************************************************/ if($ViewONLY == false) { if($illegalPicks == true) { $UpdatePicksquery = "UPDATE picks SET islegal ='N' WHERE playerid = " . $Players_row['playerid'] . " and week = $week and year = $year"; $result = mysql_query($UpdatePicksquery); //Insert new record with the players updated legal picks $InsertLegalPicksquery = "INSERT INTO picks (playerid, week, year, pick1, pick2, pick3, pick4, pick5, UsedDefault) VALUES (" . $Players_row['playerid'] . ", $week, $year, '" . (string)$Picks[0][1] . "', '" . (string)$Picks[0][2] . "', '" . (string)$Picks[0][3] . "', '" . (string)$Picks[0][4] . "', '" . (string)$Picks[0][5] . "') , '" . $useddefault ."' "; $result = mysql_query($InsertLegalPicksquery); } } //calculate the number of points earned for the given week //the formula is 15(max) points minus (the points position minus one ). //Get the race results for a given week. $TotalPoints = 0; $ActualRaceWinner = ''; $RaceResults = mysql_query("SELECT * FROM raceresults where week = $week and year=$year order by finish Limit 43 ", $MySQLConnection); //echo "<br>"; echo "| <b>Who Earned Points this Week</b> |<br>"; echo "|-----------------------------------|<br>"; while($RaceResults_row = mysql_fetch_assoc($RaceResults)) { //Save Race Winner if($ActualRaceWinner == '') $ActualRaceWinner = $RaceResults_row['car']; for($y=1; $y <= 5; $y++) { $Filler1 = " "; if ( strlen($RaceResults_row['car']) == 1) $Filler1 .= " "; if ( strlen((43 - ($RaceResults_row['finish']-1))) == 1) $Filler1 .= " "; if(strcmp($Picks[0][$y] ,$RaceResults_row['car']) == 0 && $Invalid[$y] == 'N' ) // strlen(strstr($LastWeekInvalidPicks, $Picks[0][$y])) <= 0 { //OLD POINTS CALCULATION (ONLY POINTS FOR THE TOP 15 DRIVERS //echo "| Car # " . $RaceResults_row['car'] . " Earned " . (15 - ($RaceResults_row['finish']-1)) . " Points " . $Filler1 . "|<br>"; //$TotalPoints += 15 - ($RaceResults_row['finish']-1); //AWARD POINTS FOR EACH DRIVER BASED ON FINISHING POSITION echo "| Car # " . $RaceResults_row['car'] . " Earned " . (43 - ($RaceResults_row['finish']-1)) . " Points " . $Filler1 . "|<br>"; $TotalPoints += 43 - ($RaceResults_row['finish']-1); //CHECK IF THE PLAYERS RACE WINNER SELECTION WAS A VALID PICK. //DETERMINE IF THE CURRENT PLAYER HAS PICKED THE RACE WINNER //IF THE RACE WINNER WAS SELECTED AN ADDITIONAL 5 POINTS WILL //BE AWARDED. //if($PlayersRaceWinnerSel == $ActualRaceWinner && $Picks[0][$y] == $ActualRaceWinner){ if($Picks[0][$y] == $ActualRaceWinner){ //IF THE RACE WINNER IS ONE OF THE 5 DRIVERS THE PLAYER PICKED AWARD THE BONUS POINTS echo "Winner = " . $Picks[0][$y] . "<br>"; $TotalPoints += 3; } } } } echo "|-----------------------------------|<br>"; $Filler = ""; if($TotalPoints < 10) $Filler = " "; //Construct a comma deliminated string with all the invalid car numbers. $sInvalidPicks = ""; $seperator = ""; if(sizeof($Invalid) > 0) { for($i = 1; $i < sizeof($Invalid); $i++) { if($Invalid[$i] == 'Y') { $sInvalidPicks .= $seperator . $Picks[0][$i]; $seperator = ","; } } } echo "| <B>Total Points Earned: " . $TotalPoints . $Filler . " </b>|<br>"; echo "|-----------------------------------|<br>"; if($ViewONLY == false) { //Save the total points earned for the current week in the picks table $UpdatePicksquery = "UPDATE picks SET totalpoints = $TotalPoints, invalidpicks='$sInvalidPicks' WHERE playerid = " . $Players_row['playerid'] . " and week = $week and year = $year"; $result = mysql_query($UpdatePicksquery); //Get Current Points Position $SelectPlayerPoints = mysql_query("Select * from playerspoints where playerid= " . $Players_row['playerid'] . " and year=$year", $MySQLConnection); $SelectPlayerPoints_result = mysql_fetch_assoc($SelectPlayerPoints); //compute grand total for player $GrandTotal = $SelectPlayerPoints_result['totalpoints']; $GrandTotal = $GrandTotal + $TotalPoints; //Update the lastpos field in the playerspoints table $UpdateLastPosquery = "UPDATE playerspoints SET lastpos = " . $SelectPlayerPoints_result['curpos'] . ", totalpoints = $GrandTotal WHERE playerid= " . $Players_row['playerid'] . " and year=$year"; $result_lastpos = mysql_query($UpdateLastPosquery); } } } //end while ($PlayersPicks_row = mysql_fetch_assoc($PlayersPicks)) { /****************************************************************** Check to see if it's week of the All-Star race, if so then all players have a chance to pick the race winner. If a player picks the All-Star winner they will be awarded bonus points. ******************************************************************/ if($week == intval($_ALL_STAR_WEEK)) { AddAllStarBonusPoints($year, $ViewONLY, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON); } /****************************************************************** Check to see if it's week 26, if so then all players total points are adjusted to bring them half the distance to the leader ******************************************************************/ if($week == $_CALCULATE_BONUS1_WEEK ) { AdjustPointsAfterWeek26($year, $ViewONLY, $_CALCULATE_BONUS1_WEEK, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON ); //AdjustPointsAfterWeek26($year, $ViewONLY, $_CALCULATE_BONUS1_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON ); } /****************************************************************** Check to see if it's week 36, if so then calculate any bonus points for those players who picked the champion at week 26. ******************************************************************/ if($week == $_NUM_RACES_IN_SEASON) { AdjustPointsAfterWeek36($year, $ViewONLY, $_NUM_RACES_IN_SEASON, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON); // AdjustPointsAfterWeek36($year, $ViewONLY, $_NUM_RACES_IN_SEASON, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON); } /**************************************************** Update the curpos field in the playerspoints table *****************************************************/ if($ViewONLY == false){ $CurrPlayerPoints= mysql_query("SELECT * FROM players inner join playerspoints on players.playerid = playerspoints.playerid where playerspoints.year = $year Order by totalpoints Desc ", $MySQLConnection); $PrevTotalPoints = 0; $pos = 1; $indx = 1; while($CurrPlayerPoints_row = mysql_fetch_assoc($CurrPlayerPoints)) { //If the previous players points match the current players total points then //assign them the same position. if ($PrevTotalPoints != $CurrPlayerPoints_row['totalpoints']) { $pos = $indx; } $indx++; $UpdateLastPosquery = "UPDATE playerspoints SET curpos= " . intval($pos) . " WHERE playerid=" . $CurrPlayerPoints_row['playerid'] . " and year=$year"; $result_lastpos = mysql_query($UpdateLastPosquery); $PrevTotalPoints = $CurrPlayerPoints_row['totalpoints']; } } }//end function ComputeWeeklyScore($week) function DetermineInvalidPicks(&$InvalidPicks, $Picks, $min, $max, $maxtotal) { //determine the invalid pick $countValidPicks = 1; for($i=1; $i <= 5; $i++) { if($Picks[1][$i] >= $min && $Picks[1][$i] <= $max) { if( $countValidPicks <= $maxtotal) { $countValidPicks++; }else { //echo "Invalid Car # " . (string)$Picks[0][$i] . " (" . $i . ")<bR>"; $InvalidPicks[0][$GLOBALS['invalidIndx']] = $i; //The index in the array that holds the bad pick $InvalidPicks[1][$GLOBALS['invalidIndx']] = (string)$Picks[0][$i]; //The car number that is invalid $GLOBALS['invalidIndx'] = $GLOBALS['invalidIndx'] + 1; } } } } /****************************************************************** //this function will find the next valid points standings position //to replace a players invalid pick *******************************************************************/ function FindNextValidDriver($week, $playerid, $PosIndx, $year) { $MySQLConnection = ConnString(); /* $hostname = "localhost"; $database = "game"; $username = "root"; $password = "mysql!"; $MySQLConnection = mysql_connect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); */ //Live /*$hostname = "revindes.ipowermysql.com"; $database = "game"; $username = "nascar"; $password = "TamThs48"; $MySQLConnection = mysql_connect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db ("game");*/ //Get the currentl players picks from the previous week and the current week //this function will make sure the replacement driver is not one that they picked //in the previous week or this week. //$prevWeek = $week - 1; //Get the driver in pos $PosIndx //then check to see if the player picked them last week. //if no then we are done and that position should be returned. //else increase the PosIndx by 1 and try again. //Techo "SELECT * FROM pointsstandings where week = " . intval($week-1) . " and rank = $PosIndx<br><Br>"; $PointsStandings = mysql_query("SELECT * FROM pointsstandings where week = " . intval($week-1) . " and rank = $PosIndx and Year(createddate) = $year", $MySQLConnection); $PointsStandings_row = mysql_fetch_assoc($PointsStandings); //need to get the car number some how? $car = (string)$PointsStandings_row['car']; $pos = $PointsStandings_row['rank']; //echo "<br>"; // echo "posindex: " . $PosIndx . "<br>"; // echo "playerid: " . $week . "<br>"; // echo "playerid: " . $playerid . "<br>"; // echo "car: " . $car . "<br>"; //echo "First look<br>"; //echo "posindx = " . $PosIndx . "<br>"; //echo "car= " . $car . "<br><br>"; //echo "SELECT * FROM picks where playerid=$playerid and (pick1=$car or pick2=$car or pick3=$car or pick4=$car or pick5=$car) and (week=$week or week=$week-1)<br><br>"; $LastWeeksPicks = mysql_query("SELECT * FROM picks where playerid=$playerid and (pick1='$car' or pick2='$car' or pick3='$car' or pick4='$car' or pick5='$car') and (week=$week or week=$week-1) and islegal='Y' and Year=$year", $MySQLConnection); while($LastWeeksrPicks_row = mysql_fetch_assoc($LastWeeksPicks))//mysql_num_rows($LastWeeksPicks) > 0) { //echo "pickid: " . $LastWeeksrPicks_row['pickid'] . "<br>" ; if($LastWeeksrPicks_row['pickid'] > 0 && mysql_num_rows($LastWeeksPicks) > 0) { $PosIndx++; $PointsStandings = mysql_query("SELECT * FROM pointsstandings where week = " . intval($week-1) . " and rank = $PosIndx and Year(createddate)=$year", $MySQLConnection); $PointsStandings_row = mysql_fetch_assoc($PointsStandings); $car = (string)$PointsStandings_row['car']; $pos = $PointsStandings_row['rank']; $LastWeeksPicks = mysql_query("SELECT * FROM picks where playerid=$playerid and (pick1='$car' or pick2='$car' or pick3='$car' or pick4='$car' or pick5='$car') and (week=$week or week=$week-1) and islegal='Y' and Year=$year", $MySQLConnection); //$LastWeeksrPicks_row = mysql_fetch_assoc($LastWeeksPicks); } } //return $PointsStandings_row['car'] . ";" . $PointsStandings_row['rank']; //this is the car the player has been assigned. return $car . ";" . $pos; } function CarUsedLastWeek($week, $playerid, $car, $year, $_CALCULATE_BONUS1_WEEK) { $MySQLConnection = ConnString(); //If the week is the first week in the chase then //allow players to reuse picks from the previous week. if($week == $_CALCULATE_BONUS1_WEEK) return false; $LastWeeksPicks2 = mysql_query("SELECT * FROM picks where playerid=$playerid and (pick1='$car' or pick2='$car' or pick3='$car' or pick4='$car' or pick5='$car') and (week=$week-1) and islegal='Y' and year=$year", $MySQLConnection); $LastWeeksrPicks_row2 = mysql_fetch_assoc($LastWeeksPicks2); if($LastWeeksrPicks_row2['pickid'] > 0) { return true; } return false; } function MoveValueToEndofArray(&$Picks, $curindx) { $curCar = (string)$Picks[0][$curindx]; $curPos = $Picks[1][$curindx]; for($t = $curindx; $t < 5; $t++) { //Get the next values $tmpCar = (string)$Picks[0][$t+1]; $tmpPos = $Picks[1][$t+1]; //Set them to the previous $Picks[0][$t] = (string)$tmpCar; $Picks[1][$t]= $tmpPos; } //Set the values of the current index passed int to the end of the array $Picks[0][5] = (string)$curCar; $Picks[1][5]= $curPos; } function SetDefaultPicks(&$CarNum, $week, $year) { $MySQLConnection = ConnString(); $indx = 1; if($week == 1) { //Get the points standings from the end of last season. $defaultPicks = mysql_query("SELECT * FROM pointsstandings where (rank=5 or rank=10 or rank=15 or rank=20 or rank=25) and week=$_NUM_RACES_IN_SEASON and Year(createddate)=$year-1", $MySQLConnection); }else { $defaultPicks = mysql_query("SELECT * FROM pointsstandings where (rank=5 or rank=10 or rank=15 or rank=20 or rank=25) and Year(createddate)=$year and week = " . intval($week-1) . " order by rank desc", $MySQLConnection); } while($defaultPicks_row = mysql_fetch_assoc($defaultPicks)) { if($defaultPicks_row['week'] > 0) { $CarNum[$indx] = (string)$defaultPicks_row['car']; $indx++; } } } function AddAllStarBonusPoints($year, $ViewONLY, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON) { $MySQLConnection = ConnString(); //Get Current Players Totals $playerspoints = mysql_query("SELECT * FROM players inner join playerspoints on players.playerid = playerspoints.playerid where players.year=$year and players.isActive='Y' order by totalpoints desc", $MySQLConnection); //$playerspoints_row = mysql_fetch_assoc($playerspoints); while($playerspoints_row = mysql_fetch_assoc($playerspoints)) { $playerid = $playerspoints_row['playerid']; $playerPointsTotal = $playerspoints_row['totalpoints']; //Add Bonus Points $BonusPoints = CalculateBonusPoints($playerspoints_row['playerid'], $year, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON); $BPoints = explode(";", $BonusPoints); $newPointTotal = $playerPointsTotal + $BPoints[2]; //add the total points for picking the all star winner //Update the players total points if($ViewONLY == false) { $Updatequery = "UPDATE playerspoints SET totalpoints= $newPointTotal WHERE playerid=" . $playerid . " and year=$year"; $result = mysql_query($Updatequery); } echo $playerspoints_row['screenname'] . " Points after All-Star Race = " . $newPointTotal . "<br><br>"; } } /* This function will adjust all of the players points after the 26th week. this will move everyone halfway up to the leader. i.e. Leader has 520 points. The person is second has 480 points. The person is third has 475 points. Leader stays at 520 points. Person in second now has 500 points [ 480+((520-480)/2) ] Person in third now has 498 points [ 475+((520-475)/2) ] */ function AdjustPointsAfterWeek26($year, $ViewONLY, $_CALCULATE_BONUS1_WEEK, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON ) { $MySQLConnection = ConnString(); echo "Calculating Bonus #1 <br>"; //Get Current Players Totals $playerspoints = mysql_query("SELECT * FROM players inner join playerspoints on players.playerid = playerspoints.playerid where playerspoints.year=$year and players.isActive='Y' order by playerspoints.totalpoints desc", $MySQLConnection); $playerspoints_row = mysql_fetch_assoc($playerspoints); //Get the leaders points total before thier bonus points are added. $LeadersPoints = $playerspoints_row['totalpoints']; $SEED = 12; echo "Leaders Point Total: " . 2 * $SEED. "<br>"; //add bonus points for player in 1st place $BonusPoints = CalculateBonusPoints($playerspoints_row['playerid'], $year, $_CALCULATE_BONUS1_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON ); $BPoints = explode(";", $BonusPoints); echo $playerspoints_row['screenname'] . " bonus #1 = " . $BPoints[0] . "<br>"; $TotalBonusPoints = $BPoints[0] + $BPoints[1]; $newPointTotal = (2 * $SEED) + $TotalBonusPoints; //$playerspoints_row['totalpoints'] + $TotalBonusPoints; //Update the players total points if($ViewONLY == false) { $UpdatequeryLeader = "UPDATE playerspoints SET totalpoints= $newPointTotal WHERE playerid=" . $playerspoints_row['playerid'] . " and year=$year"; $resultLeader = mysql_query($UpdatequeryLeader); } //Now calculate the bonus points for the rest of the players and adjust the totals half way to the leader. while($playerspoints_row = mysql_fetch_assoc($playerspoints)) { $SEED = $SEED - 1; $playerid = $playerspoints_row['playerid']; $playerPointsTotal = $playerspoints_row['totalpoints']; $newPointTotal = 2 * $SEED; // $playerPointsTotal + ceil((($LeadersPoints-$playerPointsTotal)/2)); //Add Bonus Points $BonusPoints = CalculateBonusPoints($playerspoints_row['playerid'], $year, $_CALCULATE_BONUS1_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON ); $BPoints = explode(";", $BonusPoints); echo $playerspoints_row['screenname'] . " bonus #1 = " . $BPoints[0] . "<br>"; $TotalBonusPoints = $BPoints[0] + $BPoints[1]; $newPointTotal = $newPointTotal + $TotalBonusPoints; //Update the players total points if($ViewONLY == false) { $Updatequery = "UPDATE playerspoints SET totalpoints= $newPointTotal WHERE playerid=" . $playerid . " and year=$year"; $result = mysql_query($Updatequery); } echo $playerspoints_row['screenname'] . " New Total = " . $newPointTotal . "<br><bR>"; } } function AdjustPointsAfterWeek36($year, $ViewONLY, $_NUM_RACES_IN_SEASON, $_ALL_STAR_WEEK, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON) { $MySQLConnection = ConnString(); //Get Current Players Totals $playerspoints = mysql_query("SELECT * FROM players inner join playerspoints on players.playerid = playerspoints.playerid where players.year=$year and players.isActive='Y' order by totalpoints desc", $MySQLConnection); //$playerspoints_row = mysql_fetch_assoc($playerspoints); while($playerspoints_row = mysql_fetch_assoc($playerspoints)) { $playerid = $playerspoints_row['playerid']; $playerPointsTotal = $playerspoints_row['totalpoints']; //Add Bonus Points $BonusPoints = CalculateBonusPoints($playerspoints_row['playerid'], $year, $_NUM_RACES_IN_SEASON, $_CALCULATE_BONUS1_WEEK , $_ALL_STAR_WEEK ,$_NUM_RACES_IN_SEASON); $BPoints = explode(";", $BonusPoints); $newPointTotal = $playerPointsTotal + $BPoints[1]; //add the total points for picking the champion //Update the players total points if($ViewONLY == false) { $Updatequery = "UPDATE playerspoints SET totalpoints= $newPointTotal WHERE playerid=" . $playerid . " and year=$year"; $result = mysql_query($Updatequery); } echo $playerspoints_row['screenname'] . " New Total = " . $newPointTotal . "<br>"; } } function DriverAlreadyUsed($car, $UsedAr) { for($i=1;$i <= 5; $i++) if(strcmp($car,$UsedAr[$i]) == 0) return true; return false; } ?>
© 2017 -
ZeroByte.ID
.