Advertisement
EckOp

Crazy Math AutoIT

Mar 19th, 2016
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.82 KB | None | 0 0
  1. ; CRAZY MATH
  2. ; code by opdo.top
  3. Global $user_name, $user_point,$game_mode
  4. Global $file_ini = @ScriptDir&'\Setting.ini'
  5. Do
  6. $user_name = InputBox ("Mời nhập tên","Chào mừng bạn đến với trò chơi CRAZY MATH. Xin mời bạn nhập tên để tiếp tục:"&@CRLF&'Ấn nút Cancel để thoát')
  7. If @error = 1 Then Exit
  8. Until $user_name <> ''
  9. Global $user_last_point = IniRead($file_ini,"CRAZYMATH",$user_name,0)
  10. While 1
  11.     $game_mode = InputBox("CRAZY MATH","Mời "&$user_name&" chọn tính năng bằng cách điền vào ô bên dưới và bấm OK:"&@CRLF&'- Gõ "1": Bắt đầu chơi'&@CRLF&'- Gõ "2": Xem bảng điểm'&@CRLF&'- Còn lại: Thoát')
  12.     If Number($game_mode) = 1 Then
  13.         $user_point = 0
  14.         For $i = 1 To 10
  15.             Local $phep_tinh = StringSplit("+-*/","")[Random(1,4,1)]
  16.             Local $so_hang[2] = [Random(1,9,1),Random(1,9,1)]
  17.             Local $dap_an = Int(Execute($so_hang[0]&$phep_tinh&$so_hang[1]))
  18.             Local $tip = $phep_tinh == '/' ? ' (chỉ lấy phần nguyên)' : ''
  19.             Local $tra_loi = InputBox("CRAZY MATH","Câu số "&$i&" - Điểm "&$user_point&@CRLF&$so_hang[0]&" "&$phep_tinh&" "&$so_hang[1]&" = ?" & $tip,"","",-1,-1,Default,Default,3)
  20.             If @error = 1 Then ExitLoop
  21.             If $tra_loi <> '' and Number($tra_loi) = Number($dap_an) Then $user_point += 1
  22.         Next
  23.         If $i > 10 Then
  24.             MsgBox(64,"Thông báo","Xin chúc mừng, bạn đã hoàn tất phần thi của mình."&@CRLF&"Điểm đạt được: "&$user_point)
  25.             If $user_last_point < $user_point Then
  26.                 IniWrite($file_ini,"CRAZYMATH",$user_name,$user_point)
  27.                 $user_last_point = $user_point
  28.             EndIf
  29.         EndIf
  30.     ElseIf Number($game_mode) = 2 Then
  31.         Local $user_last_point = IniRead($file_ini,"CRAZYMATH",$user_name,0)
  32.         MsgBox(64,"CRAZY MATH","Điểm của bạn "&$user_name&" là: "&$user_last_point)
  33.     Else
  34.         Exit
  35.     EndIf
  36. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement