home *** CD-ROM | disk | FTP | other *** search
- function check_results()
- {
- dist_to_middle = new array();
- correct_dtm = new array();
- sorted = new array();
- CForder_of_array = new array("xx","c","h","c","h","c","h","c","h");
- UForder_of_array = new array("xx","h","c","h","c","h","c","h","c");
- temp_c_OR_H = new array();
- c_OR_H = new array();
- if(first_play == "user")
- {
- temp_C_OR_H = UForder_of_array;
- }
- else
- {
- temp_C_OR_H = CForder_of_array;
- }
- ball = 1;
- while(8 >= ball)
- {
- if(in_zone[ball])
- {
- thisball = eval("stone" + ball);
- dtmx = middle_movie._x - realx[ball];
- dtmy = middle_movie._y - (400 - realy[ball]);
- trace("mmmy = " + middle_movie._y);
- trace("mmmx = " + middle_movie._x);
- dist_to_middle[ball] = Math.sqrt(dtmx * dtmx + dtmy * dtmy);
- }
- else
- {
- dist_to_middle[ball] = 999999;
- temp_c_or_h[ball] = "x";
- }
- trace("dist_to_middle" + dist_to_middle[ball]);
- if(home_radius + 26 < dist_to_middle[ball])
- {
- dist_to_middle[ball] = 999999;
- temp_c_or_h[ball] = "x";
- }
- ball++;
- }
- ball = 1;
- while(8 >= ball)
- {
- correct_dtm[ball] = dist_to_middle[ball];
- c_or_h[ball] = temp_c_or_h[ball];
- ball++;
- }
- sorted_list = false;
- while(!sorted_list)
- {
- sorted_list = true;
- i = 1;
- while(7 >= i)
- {
- if(correct_dtm[i + 1] < correct_dtm[i])
- {
- sorted_list = false;
- temp_sc = correct_dtm[i];
- correct_dtm[i] = correct_dtm[i + 1];
- correct_dtm[i + 1] = temp_sc;
- temp_sc = c_or_h[i];
- c_or_h[i] = c_or_h[i + 1];
- c_or_h[i + 1] = temp_sc;
- }
- i++;
- }
- }
- ball = 1;
- while(8 >= ball)
- {
- trace("stone " + ball + " dist " + correct_dtm[ball] + " " + c_or_h[ball]);
- ball++;
- }
- nearest = c_or_h[1];
- if(nearest == "c" or nearest == "h")
- {
- pts = 1;
- found_end = false;
- i = 2;
- while(4 >= i)
- {
- if(nearest == c_or_h[i] and !found_end)
- {
- pts++;
- }
- else
- {
- found_end = true;
- }
- i++;
- }
- }
- else
- {
- pts = 0;
- }
- trace("score is...... " + pts + " to " + nearest);
- if(nearest == "c")
- {
- computer_score += pts;
- }
- else
- {
- user_score += pts;
- }
- }
- if(stone_in_use == 8)
- {
- check_results();
- totals_message = "";
- if(end_no == 1)
- {
- if(user_score < computer_score)
- {
- totals_message = " RED: " + (computer_score - user_score);
- }
- if(computer_score < user_score)
- {
- totals_message = " BLUE: " + (- computer_score + user_score);
- }
- if(computer_score == user_score)
- {
- totals_message = "";
- }
- }
- else
- {
- totals_message = " BLUE: " + user_score + " RED: " + computer_score;
- }
- ends_message = "";
- score_message = ends_message + totals_message;
- if(end_no == 2)
- {
- winpoints = user_score - computer_score;
- }
- }
-