数值模拟
来源:互联网 发布:查了啊网络电视直播 编辑:程序博客网 时间:2024/04/27 16:13
Public getTili As BooleanPublic buyTili As BooleanPublic cishu As IntegerPublic dengji As IntegerPublic tili As IntegerPublic jingyan As IntegerPublic zijin As LongPublic tianshu As IntegerPrivate Sub Check1_Click()If Check1.Value = 1 Then 'MsgBox "被选择" getTili = TrueElse 'MsgBox "未被选择" getTili = FalseEnd IfEnd SubPrivate Sub Check2_Click()If Check2.Value = 1 Then 'MsgBox "被选择" buyTili = TrueElse 'MsgBox "未被选择" buyTili = FalseEnd IfEnd SubPrivate Sub readButton_Click()FileNumber = FreeFileOpen "player.txt" For Input As #FileNumberDo While Not EOF(FileNumber) Line Input #FileNumber, TextLine temp = temp + TextLine + vbCrLf showTxt.Text = tempLoopClose #FileNumberSet re = New RegExpre.Pattern = "等级:(\d+).*\n当前经验:(\d+).*\n当前体力:(\d+).*\n资金:(\d+).*\n可购买体力次数:(\d+)"If (re.Test(temp) = True) Then Set re1 = re.Execute(temp)(0) cishu = re1.SubMatches(4) dengji = re1.SubMatches(0) tili = re1.SubMatches(2) jingyan = re1.SubMatches(1) zijin = re1.SubMatches(3) showMsgElse MsgBox "文件错误"End IfEnd SubPublic Sub shuaFB()Debug.Print "刷副本"tili = tili - 6zj = 610 + 10 * Int(dengji / 5)zijin = zijin + zjDebug.Print "获得资金:" & zjjingyan = jingyan + 6End SubPublic Sub suanLevel()Dim a, b As IntegerSet re = New RegExpre.Pattern = "(\d+)\t(\d+)"FileNumber = FreeFileOpen "level.txt" For Input As #FileNumberDo While Not EOF(FileNumber) Line Input #FileNumber, TextLine If re.Test(TextLine) = True Then Set re1 = re.Execute(TextLine)(0) a = re1.SubMatches(0) b = re1.SubMatches(1) If a = dengji And b > jingyan Then Close #FileNumber Exit Sub End If If a = dengji And b <= jingyan Then Debug.Print "Level UP" dengji = dengji + 1 jingyan = jingyan - b max_tili = dengji + 59 tili = tili + 20 End If End IfLoop'Close #FileNumberEnd SubPublic Sub showMsg()levelTxt(0).Text = dengjijingyanTxt(2).Text = jingyantiliTxt(1).Text = tilimoneyTxt(3).Text = zijinEnd SubPrivate Sub runButton_Click()If (Text1.Text = "") Then MsgBox "请输入天数"Else tianshu = Text1.TextEnd IfFileNumber = FreeFileOpen "Log.txt" For Output As #FileNumberFor i = 1 To tianshu Print #FileNumber, "==== 第" + Str(i) + "天 ====" temp = temp + "第" + Str(i) + "天:" + vbCrLf tili = dengji + 59 getTili = True buyTili = True n = 0 While tili >= 6 Print #FileNumber, "角色等级:" + Str(dengji) + " 角色体力:" + Str(tili) + " 当前资金:" + Str(zijin) shuaFB n = n + 1 suanLevel If tili < 6 And Check1.Value = 1 And getTili = True Then tili = tili + 120 getTili = False Print #FileNumber, "领取免费体力120点" End If If tili < 6 And Check2.Value = 1 And buyTili = True Then tl = 120 * cishu tili = tili + tl buyTili = False Print #FileNumber, "购买体力" + Str(tl) + "点" End If Wend Print #FileNumber, "通关主线次数:" + Str(n) temp = temp + "当前等级:" + Str(dengji) + " 当前资金:" + Str(zijin) + vbCrLf temp = temp + "通关主线次数:" + Str(n) + vbCrLfNext ishowTxt.Text = tempPrint #FileNumber, "角色等级:" + Str(dengji) + " 当前资金:" + Str(zijin)Close #FileNumberEnd SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)If KeyAscii = 8 ThenExit SubEnd IfIf KeyAscii < Asc("0") Or KeyAscii > Asc("9") ThenKeyAscii = 0MsgBox "只能输入数字"End IfEnd Sub
0 0
- 数值模拟
- 复杂积分的计算机模拟数值计算方法
- C#数值计算之模拟退火法简介(一)
- C#数值计算之模拟退火法简介(二)
- 大气科学和地球流体力学数值模拟国家重点实验室
- C#数值计算之模拟退火法简介(一)
- C#数值计算之模拟退火法简介(二)
- C#数值计算之模拟退火法简介(一)
- 数值模拟实时三维可视化的C#与OpenGL实现
- 数值模拟偏微分方程的三种方法介绍
- MMO游戏数值框架概述(偏模拟方向)
- 表示数值的字符串(模拟+剑指offer)
- 数值得整数次方--模拟pow函数的功能
- 封装:Eclipse油藏数值模拟源文件解析封装
- 算法第七节:模拟算法解决“猜数值游戏”问题
- 数值
- 数值
- 数值
- Android 打包,安装,卸载流程
- 【unity 代码升华篇】委托、事件全解析(一)
- cf467A George and Accommodation
- GitHub 优秀的 Android 开源项目
- Cocos2d-js学习--helloword
- 数值模拟
- 彩灯高高挂(bfs)
- 非主流伤感网名_好奇怪每次我隐身你才上线
- 初学AJAX4---使用jquery实现ajax
- 设计模式--6大原则--开闭原则
- 从尾到头打印链表
- Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)(转)
- 约瑟夫问题
- Jetty7.5.1+Ext4.2.1+websocket实例