function varargout = choujiang(varargin)
% CHOUJIANG MATLAB code for choujiang.fig
% CHOUJIANG, by itself, creates a new CHOUJIANG or raises the existing
% singleton*.
%
% H = CHOUJIANG returns the handle to a new CHOUJIANG or the handle to
% the existing singleton*.
%
% CHOUJIANG('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CHOUJIANG.M with the given input arguments.
%
% CHOUJIANG('Property','Value',...) creates a new CHOUJIANG or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before choujiang_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to choujiang_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help choujiang
% Last Modified by GUIDE v2.5 02-Nov-2013 00:53:34
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @choujiang_OpeningFcn, ...
'gui_OutputFcn', @choujiang_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before choujiang is made visible.
function choujiang_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to choujiang (see VARARGIN)
% Choose default command line output for choujiang
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes choujiang wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = choujiang_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function e11_Callback(hObject, eventdata, handles)
% hObject handle to e11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of e11 as text
% str2double(get(hObject,'String')) returns contents of e11 as a double
% --- Executes during object creation, after setting all properties.
function e11_CreateFcn(hObject, eventdata, handles)
% hObject handle to e11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function e12_Callback(hObject, eventdata, handles)
% hObject handle to e12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of e12 as text
% str2double(get(hObject,'String')) returns contents of e12 as a double
% --- Executes during object creation, after setting all properties.
function e12_CreateFcn(hObject, eventdata, handles)
% hObject handle to e12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function e13_Callback(hObject, eventdata, handles)
% hObject handle to e13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of e13 as text
% str2double(get(hObject,'String')) returns contents of e13 as a double
% --- Executes during object creation, after setting all properties.
function e13_CreateFcn(hObject, eventdata, handles)
% hObject handle to e13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in run.
function run_Callback(hObject, eventdata, handles)
% hObject handle to run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global number_people;
global next_number_people;
global row1;
global row2;
global column1;
global column2;
global floor_number;
global im;
global rate;
global row1_begin;
% start_level=str2num(get(handles.e11,'string'));
% end_level=str2num(get(handles.e12,'string'));
% number=str2num(get(handles.e13,'string'));
%set(handles.e21,'string',num2str(start_level));
%晚会需要改的%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
row1_begin=3; %一楼开始的排数,前面几排可能不抽
floor_number=2; %如果只有一楼有人坐,则改为1
row1=27; %一楼的排数
column1=46; %一楼一排的座位数
row2=14; %二楼的排数,如果后面没人坐,则改
column2=44; %二楼一排的座位数
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
im=0;
rate=row1/(row1+row2);
if number_people>3
next_number_people=number_people-3;
else
next_number_people=0;
end
if number_people>=3
while(~im)
if rand<rate
set(handles.e11,'string',num2str(1));
lucky12=round(row1_begin+(row1-1)*rand);
set(handles.e12,'string',num2str(lucky12));
lucky13=round(1+(column1-1)*rand);
set(handles.e13,'string',num2str(lucky13));
else
set(handles.e11,'string',num2str(floor_number));
lucky12=round(1+(row2-1)*rand);
set(handles.e12,'string',num2str(lucky12));
lucky13=round(1+(column2-1)*rand);
set(handles.e13,'string',num2str(lucky13));
end
if rand<rate
set(handles.e21,'string',num2str(1));
lucky22=round(row1_begin+(row1-1)*rand);
set(handles.e22,'string',num2str(lucky22));
lucky23=round(1+(column1-1)*rand);
set(handles.e23,'string',num2str(lucky23));
else
set(handles.e21,'string',num2str(floor_number));
lucky22=round(1+(row2-1)*rand);
set(handles.e22,'string',num2str(lucky22));
lucky23=round(1+(column2-1)*rand);
set(handles.e23,'string',num2str(lucky23));
end
if rand<rate
set(handles.e31,'string',num2str(1));
lucky32=round(row1_begin+(row1-1)*rand);
set(handles.