vb 抓取搜狗微信 抓取过多的时候 搜狗就要求输入验证码, 怎么才能没有验证码呢?

Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP")
xmlHTTP1.Open "get", "http://weixin.sogou.com/weixin?type=1&query=" 参数ss), True
xmlHTTP1.send
While xmlHTTP1.ReadyState <> 4
DoEvents
Wend
body = xmlHTTP1.responseText
Set xmlHTTP1 = Nothing

    以上是我的抓取代码,  主要问题是 搜狗搜索次数过多的时候 就要输入验证码, 怎么才能 正常抓取 不输入验证么呢

4个回答

降低访问频率吧!!要么识别验证码,后者不容易做。表示最近遇到同样的问题,解决中。。。

你的问题现在解决了吗?

楼主问题解决了吗,我最近用php采集也遇到过同样的问题

已解决,采集的时候带入cookies即可,但是还是需要减少访问次数

soonfei
诺维斯基 减少到多少合适呢?
接近 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
vb.net 经纬度格式 于mysql以正则判断
我于mysql里存有,经纬度_str的字段,主要是经纬度的格式,如下 118.11,39.7682 118.9937,33.0099999 也有可能是,除了经纬度的任意格式 空白 2020年1月9日 2020年1月9日 1.13前提交1.9 1.13前提交1.9 请问怎么在where 条件下,只筛选出是经纬度的格式(应该是用正则) select * from where 经纬度_str=true
.net-运行过程中主界面被释放,为什么?
本问题涉及VB.net的多线程处理, 是这样的,出现一种情况,在主线程的中添加一个后台线程,出现了主界面闪退的情况。闪退的具体情况是,主界面直接dispose掉了,进入自己写的退出 ``` Private Sub Form_Terminate_Renamed() Me.Visible = False Call MainExit() End Sub ``` 退出代码: ``` Public Sub MainExit() On Error Resume Next DebugMsg2(" Program End") End Sub ``` 释放代码(调用上面Form_Terminate_Renamed()): ``` <System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean) If Disposing Then Static fTerminateCalled As Boolean If Not fTerminateCalled Then Form_Terminate_Renamed() fTerminateCalled = True End If If Not components Is Nothing Then components.Dispose() End If End If MyBase.Dispose(Disposing) End Sub ``` 有哪些情况会导致进入到界面释放的程序里,且主线程并未中断?
vb.net 取符合IP的字串(正则)
fe80::1daa:da7:XXXX:ee9e%18 fe80::d018:846XXXX621%8 2001:b011:fXXXXXb:39c4:833a:6bfe:6015 2001:b011:feXXXXXX:d018:8463:7e6e:e621 fe80::18d3:9XXXX4:a0b5%23 10.0.75.9 192.168.1.106 172.xx.139.xx 这些文字是我进来的内容,我希望一个过滤器(正则做会更好) 上方的字串,只有符合IP格式能出来 比如进入 fe80::1daa:da7:XXXX:ee9e%18 出来则false 进入 127.0.0.1 出来则true ![图片说明](https://img-ask.csdn.net/upload/202002/06/1580979484_982065.jpg)
VB 图片保存入ACCESS遇到的问题,急需解决
1.之前在csdn里下载了一个程序 ![图片说明](https://img-ask.csdn.net/upload/202002/02/1580656826_861754.jpg) 软件可以实现保存。 但是数据库视乎太旧,而且无法添加修改字段 于是我自己做了一个ACCESS文件,添加了字段, 保存之前我做的软件里。可以打开数据库了, ![图片说明](https://img-ask.csdn.net/upload/202002/02/1580657012_79134.jpg) 点击导入 ![图片说明](https://img-ask.csdn.net/upload/202002/02/1580657077_12502.jpg) 选择文件 ![图片说明](https://img-ask.csdn.net/upload/202002/02/1580657131_397468.jpg) 之后窗口跳出 ![图片说明](https://img-ask.csdn.net/upload/202002/02/1580657185_939330.jpg) 到这一步我就没有方向了如何操作,请哪位大神教教我
java-谁能把JAVA代码转换一下VB代码
``` import java.awt.image.BufferedImage;   import java.io.File;   import java.io.IOException;   import java.io.UnsupportedEncodingException;   import javax.imageio.ImageIO;   import jp.sourceforge.qrcode.QRCodeDecoder;   import jp.sourceforge.qrcode.data.QRCodeImage;   import jp.sourceforge.qrcode.exception.DecodingFailedException;   public class QRCodeDecoderTest {   public QRCodeDecoderTest() {   } public static void main(String[] args) {   QRCodeDecoder decoder = new QRCodeDecoder();   File imageFile = new File("TestQRCode.png");   BufferedImage image = null;   try {   image = ImageIO.read(imageFile);   } catch (IOException e) {   System.out.println("Error: "+ e.getMessage());   }   try {   String decodedData = new String(decoder.decode(new J2SEImage(image)),"GBK");   System.out.println(decodedData);   } catch (DecodingFailedException dfe) {   System.out.println("Error: " + dfe.getMessage());   } catch (UnsupportedEncodingException e) {   e.printStackTrace();   }   }   }   class J2SEImage implements QRCodeImage {   BufferedImage image;   public J2SEImage(BufferedImage image) {   this.image = image;   }   public int getWidth() {   return image.getWidth();   }   public int getHeight() {   return image.getHeight();   }   public int getPixel(int x, int y) {   return image.getRGB(x, y);   }   } ```
VB中链接数据库插入数据问题?
这是窗体里的代码:executesql "insert into 收入(日期,方式,金额,项目,序号) values(" & Format(DTPicker1.Value, "yyyy-mm-dd") & "," & Combo2.Text & "," & Text2.Text & "," & Combo1.Text & "," & Text3.Text & "," & List1.Text & "," & b & ") ", str_text 这是模块中引用的代码:Public Function executesql(ByVal sql As String, msgstring As String) Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim stokens() As String On Error GoTo executesql_onerror Set cnn = New ADODB.Connection cnn.Open connectstring stokens = Split(sql) If InStr("insert,delete,update", UCase$(stokens(0))) Then cnn.Execute sql msgstring = stokens(0) & "查询成功" Else Set rst = New ADODB.Recordset rst.Open Trim$(sql), cnn, adOpenKeyset, adLockOptimistic Set executesql = rst msgstring = "查询到" & rst.RecordCount & "条记录" executesql_exit: Set cnn = Nothing Set rst = Nothing Exit Function executesql_onerror: msgstring = "查询错误" & Err.Description Resume executesql_exit End If End Function 执行之后数据显示成功但是数据库查不到输入的数据
VB中MSHFlexGrid控件中选择记录删除不了选中的记录而是删除了第一条记录?
Private Sub Command2_Click() Adodc1.RecordSource = "select * from 常用联系电话表 where 名称=" & MSHFlexGrid1.TextMatrix(MSHFlexGrid1.MouseRow, 0) Adodc1.Recordset.Delete MSHFlexGrid1.RemoveItem MSHFlexGrid1.Row End Sub ``` ## 怎么才能删除选择的记录内容呢?这个代码只能表面上看似删除了但是数据库能的内容删除的是第一条记录!求问题所在?
Palindromic Substring 字符串的问题
Problem Description In the kingdom of string, people like palindromic strings very much. They like only palindromic strings and dislike all other strings. There is a unified formula to calculate the score of a palindromic string. The score is calculated by applying the following three steps. 1. Since a palindromic string is symmetric, the second half (excluding the middle of the string if the length is odd) is got rid of, and only the rest is considered. For example, "abba" becomes "ab", "aba" becomes "ab" and "abacaba" becomes "abac". 2. Define some integer values for 'a' to 'z'. 3. Treat the rest part as a 26-based number M and the score is M modulo 777,777,777. However, different person may have different values for 'a' to 'z'. For example, if 'a' is defined as 3, 'b' is defined as 1 and c is defined as 4, then the string "accbcca" has the score (3×263+4×262+4×26+1) modulo 777777777=55537. One day, a very long string S is discovered and everyone in the kingdom wants to know that among all the palindromic substrings of S, what the one with the K-th smallest score is. Input The first line contains an integer T(1 ≤ T ≤ 20), the number of test cases. The first line in each case contains two integers n, m (1 ≤ n ≤ 100000, 1 ≤ m ≤ 20) where n is the length of S and m is the number of people in the kingdom. The second line is the string S consisting of only lowercase letters. The next m lines each containing 27 integers describes a person in the following format. Ki va vb ... vz Where va is the value of 'a' for the person, vb is the value of 'b' and so on. It is ensured that the Ki-th smallest palindromic substring exists and va, vb, ..., vz are in the range of [0, 26). But the values may coincide. Output For each person, output the score of the K-th smallest palindromic substring in one line. Print a blank line after each case. Sample Input 3 6 2 abcdca 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 4 10 zzzz 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 10 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 51 4 abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba 1 1 3 3 25 20 25 21 7 0 9 7 3 16 15 14 19 5 19 19 19 22 8 23 2 4 1 25 1 3 3 25 20 25 21 7 0 9 7 3 16 15 14 19 5 19 19 19 22 8 23 2 4 1 26 1 3 3 25 20 25 21 7 0 9 7 3 16 15 14 19 5 19 19 19 22 8 23 2 4 1 76 1 3 3 25 20 25 21 7 0 9 7 3 16 15 14 19 5 19 19 19 22 8 23 2 4 1 Sample Output 1 620 14 14 14 14 14 14 14 378 378 378 0 9 14 733665286
vb.net NumericupDown 循环(简易需求)
我有一numericupdown ,来放月份的 最小值为1,最大值为12 比如在已经是12的情况下,点上,变成1 在1的情况下,点下,变成12 请问如何实现呢?
在VisualStudio2019用VB6.0找不到工具栏的计时器。
![图片说明](https://img-ask.csdn.net/upload/202001/29/1580292547_64975.png)
VB 6.0能不能和手机上的微信软件进行通讯?怎么给微信软件发送消息?
VB 6.0能不能和手机上的微信软件进行通讯?怎么给微信软件发送消息?
【求助笔试题]】 找出VB.NET写的21点扑克牌程序中的问题
遇到一个面试题,题目要求是这样的 写了一个21点扑克牌的程序,用VB.NET写的,需要你找出其中的bugs,尽可能多 的找出,并写明错误原因 由于小弟写C#的,对VB.NET实在不熟悉,还希望有经验前辈帮忙看看 小弟不胜感觉 代码一共有6个类 分别是 Blackjack Card Deck Game Hand Player ProbabilityCalculator 代码文件如下 ``` ''' <summary> ''' Emulates a black jack game between two different AI players. 模拟两个不同的AI玩家之间的黑杰克游戏。 ''' </summary> Public Class Blackjack Public Shared ReadOnly AllCards As New List(Of Card) ''' <summary> ''' Static constructor. ''' Generates a list containing one of every possible card.生成一个包含所有可能卡片的列表 ''' This simplified game assumes a single deck of 52 cards, one of every unique suit and rank combination. ''' 这个简化的游戏假设有一副52张的牌,每副牌都有自己独特的花色和等级组合。 ''' </summary> Shared Sub New() For Each s As Card.Suit In [Enum].GetValues(GetType(Card.Suit)) For Each r As Card.Rank In [Enum].GetValues(GetType(Card.Rank)) AllCards.Add(New Card(r, s)) Next Next End Sub ''' <summary> ''' Main method. Constructs the object, plays the game, prints the output. ''' Don't change this method! ''' </summary> ''' <param name="args">Command line args, unused.</param> Public Shared Sub Main(args As String()) Dim deck As New Deck(AllCards) Dim random As New Random() Dim calculator As New ProbabilityCalculator(AllCards) Dim player1 As New Player("Harry", calculator) Dim player2 As New Player("Joe", calculator) Dim game As New Game(deck, random, player1, player2) Console.WriteLine(game.Play()) Console.ReadLine() End Sub End Class ``` Imports System Imports System.Collections.Generic Imports System.Text ''' <summary> ''' Represents a single playing card, the combination of a suit (Spades, hearts, clubs, diamonds) ''' and a rank (Ace, two, three... Jack, Queen, King). ''' 表示一张纸牌,是花色(黑桃、红心、梅花、方块)的组合 ''' 还有一排(a,二,三……杰克,王后,国王)。 ''' Any particular card is worth a number of points, according to its rank. ''' 任何一张特定的纸牌,根据它的等级,值若干点数。 ''' In this simplified game, an Ace is always worth 1 points. ''' A two is with 2 points, three worth 3, and so on. ''' The face cards (Jack, Queen, King) are worth 10 points. ''' 在这个简化的游戏中,a总是值1分 '''2是2分,3是3分,以此类推 '''脸牌(杰克、皇后、国王)值10分。 ''' </summary> Public Class Card Public Enum Suit Spades Hearts Clubs Diamonds End Enum Public Enum Rank Ace = 1 Two = 2 Three = 3 Four = 4 Five = 5 Seven = 7 Eight = 8 Nine = 9 Ten = 10 Jack = 11 Queen = 12 King = 13 End Enum ReadOnly mSuit As Suit ReadOnly mRank As Rank Public Sub New(r As Rank, s As Suit) mSuit = s mRank = r End Sub ''' <summary> ''' Returns a human readable name of the card, for example "Ace of Spades", suitable for inclusion in ''' the game's console output. ''' 返回人类可读的纸牌名称,例如“黑桃a”,适合包含在游戏控制台输出中 ''' </summary> ''' <returns>Name of the card</returns> Public ReadOnly Property Description As String Get ' Return mRank + " of" + mSuit Return mRank.ToString + " of" + mSuit.ToString End Get End Property ''' <summary> ''' Returns the number of points that this card is worth, according to its rank. ''' 返回该牌值多少分,根据其分值。 ''' </summary> ''' <returns>Point value of this card.</returns> Public ReadOnly Property Points As Integer Get Return CType(mRank, Integer) End Get End Property Public Overrides Function ToString() As String Return Description End Function End Class `` ''' <summary> ''' Represents a collection of playing cards that will be dealt in the game. ''' 表示将在游戏中处理的纸牌集合。 ''' A fresh deck usually begins with the cards in an ordered sequence according to their suit and rank. ''' 一副新牌通常是按照牌的花色和等级顺序排列的。 ''' Before dealing cards to the players, the dealer should shuffle the deck, <see cref="System.Random" /> ''' 发牌前,发牌人应洗牌 ''' otherwise cards will be dealt in their original sequence. ''' 否则,牌将按原来顺序处理 ''' During the game, the dealer deals one card at a time, removing it from the top ''' of the deck, and adding it to the player's hand. ''' 在游戏中,发牌人一次发一张牌,把它从牌顶移开 并将其添加到玩家手上。 ''' </summary> ''' <remarks></remarks> Public Class Deck ''' <summary> ''' The cards remaining to be dealt ''' 剩下要处理的牌集合 ''' </summary> Private mCards As List(Of Card) ''' <summary> ''' Constructs a fresh deck with the specified cards in the given sequence ''' 按照给定的顺序用指定的牌组构造新的牌组 ''' </summary> ''' <param name="cards">@param cards cards</param> Public Sub New(cards As List(Of Card)) mCards = cards End Sub ''' <summary> ''' Randomizes the sequence of the cards within the deck. ''' 将牌堆中的牌的顺序随机化 ''' </summary> Public Sub Shuffle(random As Random) ' Keep a reference to the existing cards, then build a new list and copy ' 保持对现有卡片的引用,然后建立一个新的列表并复制 ' the cards over in a random sequence. ' 这些卡片是随机排列的。 Dim originalCards As List(Of Card) = mCards Dim shuffledCards As New List(Of Card) Dim numberOfCards As Integer = originalCards.Count For i As Integer = 0 To numberOfCards Dim nextCardIndex As Integer = random.Next(originalCards.Count) Dim nextCard As Card = originalCards(nextCardIndex) shuffledCards.Add(nextCard) Next mCards = shuffledCards End Sub ''' <summary> ''' Draws a card from the top of the deck, so that it can be added to a player's hand. ''' 从牌堆顶部抽一张牌,这样它就可以加到玩家手上。 ''' </summary> ''' <returns>Dealt card</returns> Public Function Deal() As Card Return mCards(0) End Function ''' <summary> ''' Returns the list of cards in the deck, in the sequence that they are going to be dealt. ''' 返回牌堆中纸牌的列表,按将要处理它们的顺序排列。 ''' </summary> ''' <returns>Cards cards in the deck</returns> Public ReadOnly Property Cards As List(Of Card) Get Return mCards End Get End Property End Class ``` ''' <summary> ''' Controller responsible for overall game loop. ''' 负责整个游戏循环的控制器 ''' </summary> Public Class Game Private mDeck As Deck Private mRandom As Random Private mPlayer1 As Player Private mPlayer2 As Player Public Sub New(deck As Deck, random As Random, player1 As Player, player2 As Player) mDeck = deck mRandom = random mPlayer1 = player1 mPlayer2 = player2 End Sub Public ReadOnly Property Deck As Deck Get Return mDeck End Get End Property Public ReadOnly Property Random As Random Get Return mRandom End Get End Property Public ReadOnly Property Player1 As Player Get Return mPlayer1 End Get End Property Public ReadOnly Property Player2 As Player Get Return mPlayer2 End Get End Property ''' <summary> ''' Main control loop. You an imagine this routine to reflect the actions of the dealer, who ''' coordinates gameplay. ''' 主要控制回路。你可以想象这个程序反映了协调游戏玩法的商人的行动。 ''' This simple game is played by two players. ''' The dealer is given a single fresh deck of cards, which he then shuffles. ''' Each player is dealt two cards. ''' Then each player takes their turn. ''' During their turn, a player can choose to "hit", which means they want to be dealt another card, ''' or to "stand", which means they will end their turn. ''' The player may "hit" as many times as they wish before ending their turn. ''' Once both players have taken their turn, the winner is determined. ''' The winner is the player with the greatest number of points without exceeding 21. ''' 这个简单的游戏是两个玩家玩的。发牌人拿到一副新的牌,然后洗牌。每人发两张牌。然后每个玩家轮流上场 '''在他们的回合中,玩家可以选择“hit”,这意味着他们想要发另一张牌,或者选择“stand”,这意味着他们将束他们的回合。 '''玩家可以在回合结束前按自己的意愿“命中”多少次。一旦两名选手轮流上场,胜者就已确定。得分最多且不超过21分者为胜者。 ''' </summary> ''' <returns>Output from the game</returns> Public Function Play() As String Dim output As New StringBuilder() ' The game begins... Dim hand1 = New Hand(mPlayer1) hand1.AddCard(mDeck.Deal()) hand1.AddCard(mDeck.Deal()) Dim hand2 = New Hand(mPlayer2) hand1.AddCard(mDeck.Deal()) hand1.AddCard(mDeck.Deal()) output.AppendFormat("{0} starts with {1}{2}", hand1.Player.Name, hand1.Description, Environment.NewLine) output.AppendFormat("{0} starts with {1}{2}", hand2.Player.Name, hand2.Description, Environment.NewLine) ' Players take their turns Dim hands As New List(Of Hand)({hand1, hand2}) For Each hand As Hand In hands Dim name As String = hand.Player.Name output.AppendFormat("{0}'s turn...{1}", name, Environment.NewLine) While (hand.Player.WantsToHit(hand.TotalPoints)) Dim dealt As Card = mDeck.Deal() output.AppendFormat("{0} hits: {1}{2}", name, dealt.Description, Environment.NewLine) hand.AddCard(dealt) End While If hand.TotalPoints > 21 Then output.AppendFormat("{0} bursts.{1}", name, Environment.NewLine) Else output.AppendFormat("{0} stands.{1}", name, Environment.NewLine) End If Next ' Determine the winner If hand1.Beats(hand2) Then output.AppendFormat("{0} WINS!{1}", hand1.Player.Name, Environment.NewLine) ElseIf hand2.Beats(hand1) Then output.AppendFormat("{0} WINS!{1}", hand2.Player.Name, Environment.NewLine) Else output.AppendFormat("It's a DRAW!{0}", Environment.NewLine) End If Return output.ToString() End Function End Class ``` ''' <summary> ''' Represents the collection of cards that have been dealt to a player. ''' 表示已分发给玩家的纸牌集合 ''' </summary> Public Class Hand ''' <summary> ''' The cards currently held in this hand ''' </summary> Private mCards As List(Of Card) ''' <summary> ''' The player to whom this hand belongs ''' </summary> Private mPlayer As Player ''' <summary> ''' Constructs a new hand for the specified player. ''' </summary> ''' <param name="player">The player to whom this hand belongs</param> Public Sub New(player As Player) mPlayer = player mCards = New List(Of Card)() End Sub ''' <summary> ''' Returns the player that this hand belongs to. ''' </summary> ''' <returns>player</returns> Public ReadOnly Property Player As Player Get Return mPlayer End Get End Property ''' <summary> ''' Adds a card to the hand ''' </summary> ''' <param name="card">the card to be added</param> Public Sub AddCard(card As Card) mCards.Add(card) End Sub ''' <summary> ''' Returns the total points for this hand by adding up the points of each card. ''' </summary> ''' <returns>total points</returns> Public ReadOnly Property TotalPoints As Integer Get Dim points As Integer = 0 For i As Integer = 0 To (mCards.Count - 1) points += mCards(i).Points Next Return points End Get End Property ''' <summary> ''' Determines whether this hand is better than the other player's hand. ''' 确定这手牌是否比其他玩家的那手牌好 ''' In general, the winning hand is the hand with the greatest number of points. ''' 一般来说,获胜的手是得分最多的手 ''' But, if the hand exceeds 21 then it is a "bust" - the other player wins. ''' 但是,如果这只手超过21,那么它就是一个“半身像”——另一个玩家赢了 ''' If both players bust, or if their total points are the same, then it is a draw. ''' 如果双方球员都失败了,或者他们的总得分相同,那么就是平局 ''' </summary> ''' <param name="other">the hand to compare against</param> ''' <returns>True, if this is a better hand than the specified other hand</returns> Public Function Beats(other As Hand) As Boolean Dim myScore As Integer = TotalPoints If myScore > 21 Then Return False End If Dim otherScore As Integer = other.TotalPoints If otherScore > myScore Then Return False End If Return True End Function ''' <summary> ''' Returns a formatted description of the cards in the hand, suitable for screen output ''' </summary> ''' <returns>Description of the hand</returns> Public ReadOnly Property Description As String Get Dim desc As New StringBuilder() desc.Append(mCards.Count) desc.Append(" cards: ") Dim first As Boolean = True For Each card As Card In mCards If Not first Then desc.Append(", ") End If desc.Append(card.Description) first = False Next desc.Append(".") Return desc.ToString() End Get End Property End Class ``` ''' <summary> ''' Represents a player, and their decision making logic for whether to ''' "hit" or "stand" ''' </summary> Public Class Player ''' <summary> ''' A friendly name that identifies the player. ''' 一个识别玩家的友好名字 ''' </summary> Private mName As String ''' <summary> ''' Used for calculating probability of bust ''' 用于计算破产概率 ''' </summary> Private mProbabilityCalculator As ProbabilityCalculator ''' <summary> ''' Constructor. ''' </summary> ''' <param name="name">player's name</param> ''' <param name="probabilityCalculator">for calculating probability of bust</param> ''' <remarks></remarks> Public Sub New(name As String, probabilityCalculator As ProbabilityCalculator) mName = name mProbabilityCalculator = probabilityCalculator End Sub ''' <summary> ''' Returns the player's name ''' </summary> ''' <returns>name</returns> Public ReadOnly Property Name As String Get Return mName End Get End Property ''' <summary> ''' Determines whether the player would like to "hit" (have another card dealt to their hand), ''' or "stand" (end their turn). ''' In this simple implementation, the player's strategy is to hit, so long as they are more likely ''' to increase their points than they are to bust. ''' If their current points are at 21, they should always stay ''' If their current points are at 10 or below, they can never bust, so they should always hit ''' For points in between, they will hit so long as the probability of the next draw causing a bust is less ''' than 50%. ''' 决定玩家是想“击中”(手上有另一张牌),还是“站着”(结束他们的回合)。在这个简单的实现中,玩家的策略是命中, ''' 只要他们更有可能增加他们的点数而不是失败。如果他们现在的分数是21分,他们应该一直保持下去 '''如果他们现在的点数是10点或以下,他们永远不会破产,所以他们应该总是击中中间的点数,只要下一次平局导致破产的概率小于50%,他们就会击中。 ''' </summary> ''' <param name="currentPoints">The total of the cards currently held by this player</param> ''' <remarks>True if the players wants to "hit", false if they want to "stand".</remarks> Public Function WantsToHit(currentPoints As Integer) If currentPoints >= 21 Then Return False ElseIf currentPoints <= 10 Then Return True Else Return mProbabilityCalculator.CalculateProbability(currentPoints) < 0.5 End If End Function End Class ``` ''' <summary> ''' Used by the player's hit/stand decision making, to determine the probability of busting if ''' they deal another card. ''' 用于玩家的命中/立场决策,以确定如果他们发另一张牌失败的概率 ''' </summary> Public Class ProbabilityCalculator ''' <summary> ''' All possible cards ''' </summary> Private mFullDeck As List(Of Card) Public Sub New(fullDeck As List(Of Card)) mFullDeck = fullDeck End Sub ''' <summary> ''' Determines the probability of a "bust" if the players deals one more card into their hand. ''' A "bust" occurs if the next card takes their total over 21. ''' 确定一个“破产”的概率,如果玩家在他们的手上多出一张牌。如果下一张牌的总数超过21,就会发生“破产” ''' ''' The probability is simulated as follows: ''' Consider all possible cards that might be dealt next if the player chooses to "hit". ''' (Since "card counting" is a no-no in Blackjack, we imagine that *any* of the cards from a ''' normal full deck could be dealt next. ie. don't exclude cards that have already been dealt). ''' For each possibility, determine the total points that would be achieved if that card ''' were added to the player's hand, and decide whether or not it is a bust. ''' The probability of a bust is the percentage of all the combinations tried that resulted in a bust. ''' 概率模拟如下: 考虑一下,如果玩家选择“命中”,接下来可能要发的所有牌。 '''(由于“数牌”在21点游戏中是不允许的,我们认为接下来可以处理任何一张普通的整副牌中的牌。ie。不要排除已经发过的牌)。 '''对于每一种可能性,确定如果那张牌可以获得的总积分 被添加到玩家手上,并决定它是否是一个破产。 '''破产的概率是所有尝试过的导致破产的组合的百分比。 ''' ''' For example, if the player's current total is 12, then dealing any card worth 10 points ''' will result in a bust. Out of the 52 cards in a deck, 16 of them are worth 10 points (the Tens, Jacks, ''' Queens and Kings of Spades, Hearts, Clubs and Diamonds). So, the probability of a bust ''' is 0.3077 (30.77%), which is 16 divided by 52. ''' Similarly, if the player's current total is 19, there are 44 possible cards that will result in ''' a bust (everything except the aces and twos), and so the probability is 0.8462. ''' 例如,如果玩家当前的总数是12,那么处理任何值10分的牌 会导致破产。在一副牌中的52张牌中,16张值10分(10,j,黑桃、红桃、梅花和方块的王后和国王)。 ''' 因此,破产的概率是0.3077(30.77%)也就是16除以52。同样的,如果玩家当前的总数是19,那么有44张可能导致失败的牌(除了a和2以外的所有牌),所以概率是0.8462。 ''' </summary> ''' <param name="currentPoints">the total points for the player's current hand</param> ''' <returns>probability of a bust if one more card is dealt (0.5f = 50%)</returns> Public Function CalculateProbability(currentPoints As Integer) As Decimal ' Problem: we can't calculate the probability if we don't have any cards to simulate with. ' This shouldn't happen, but to prevent potential crashes, we'll return 50% ' 问题:如果我们没有卡片来模拟,我们就无法计算概率。这不应该发生,但为了防止潜在的崩溃,我们将返回50% If mFullDeck.Count = 0 Then Return 0.5 End If Dim numberOfBusts As Integer = 0 Dim numberOfNonBusts As Integer = 0 For Each card As Card In mFullDeck Dim potentialPoints = currentPoints + card.Points If (potentialPoints > 21) Then numberOfBusts += 1 Else numberOfNonBusts += 1 End If Next Return numberOfBusts / CType(numberOfNonBusts, Decimal) End Function End Class ``` ``` ```
VB.NET System.Threading.Timer执行代码片时窗体事件受到影响如何解决?
我写的程序通过使用 System.Threading.Timer类不断切换图像达成了动态背景的效果,1秒24帧。 (用这种方法是因为使用Picturebox后其他控件的BackColor设置为Transparent全部失效) ``` Public Sub GenerateTimer() objTimer = New Timer(tcb, Nothing, TimeSpan.FromSeconds(0), TimeSpan.FromMilliseconds(42)) End Sub ``` 但是发现从TimeSpan.FromMilliseconds()的参数调到100毫秒以下时,窗体效果便不再展示(包括Tooltip,Timer事件,Progressbar效果等等) 请问有什么办法能解决吗?
vb.net 点窗体上的button,来执行键盘的键 Alt+a
如题,在vb.net上要怎么实现这个效果呢? vb.net 点窗体上的button,来执行键盘的键 Alt+a
VB.net 使用Response.write()+opner和document.getElementById('TB_Linshi').value 实现子窗口值传回父窗口,传不回数值,但可以传回固定值'123',
1. 在父窗口点击BT_WO弹出子窗口,子窗口有TB_Lishi和Gridview1,Gridview1设置了AutoGenerateSelectButton="True",通过点击"选择"触心GridviewSelectedIndexChanged事件,将"选择"的行的值赋予给子页面的TB_Lishi,然后通过如下 语句:Response.Write("<script>window.opener.document.getElementById('TB_WO').value=window.document.getElementById('TB_Linshi').ID</script>"),却始终传不到数据,而采用Response.Write("<script>window.opener.document.getElementById('TB_WO').value='123'</script>")却可以传回,折腾好久,搞不明白 2. 完整代码片段如下 ``` Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged TB_Linshi.Text = Me.GridView1.SelectedRow.Cells(1).Text.ToString() Response.Write("<script>window.opener.document.getElementById('TB_WO').value=window.document.getElementById('TB_Linshi').ID</script>") '//直接关闭页面,无需点击确认按纽 document.getElementById('TB_Linshi').value Response.Write("<script>window.close();value='确定'</script>") End Sub ``` ``` ```
VB6.0怎么让PC程序给用户的手机上的微信软件发送消息?
VB6.0怎么让PC程序给用户的手机上的微信软件发送消息?怎么设置消息的文本,怎么根据微信号来发信?
初学vb,希望帮我看下这里的什么地方错了,谢谢,就一句代码
MSGBOX"欢迎来到新肯家园,大家有问题请问大象。"![图片说明](https://img-ask.csdn.net/upload/202001/14/1579010146_855922.png) ``` ```
如何用C或者C++或者VB编写一段代码,读取PC版微信某个用户发给我的信息
不是微信的二次开发,不是公众号平台,就是个人用户的微信接受到的文字消息 我的想法是从获取PC版微信的窗口句柄然后找对应控件。 开发经验没有,请哪位热心人研究下,给个例程
vb.net 正则表达式AAA_VVV_AAAA 取出最后的值(急)
例如:AAA_VVV_AAAA,我要取AAAA怎么做呢 大致的格式都为 AAA_BBBBB_CCC-->CCC 测试_我是_你好-->你好
130 个相见恨晚的超实用网站,一次性分享出来
文末没有公众号,只求 点赞 + 关注 搞学习 知乎:www.zhihu.com 大学资源网:http://www.dxzy163.com/ 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:stu
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱  极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件,   选择安装到U盘(按照操作无需更改) 三、重启进入pe系统   1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12)     选择需要启
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n
java源码分析 Arrays.asList()与Collections.unmodifiableList()
举个栗子 本章示例代码来自java编程思想——17.4.1未获支持的操作——Unsupported类。 import java.util.*; public class Unsupported { static void test(String msg, List&lt;String&gt; list) { System.out.println("--- " + msg
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
Java学习笔记(七十二)—— Cookie
概述 会话技术: 会话:一次会话中包含多次请求和响应 一次会话:浏览器第一次给服务器发送资源请求,会话建立,直到有一方断开为止 功能:在一次会话的范围内的多次请求间,共享数据 方式: 客户端会话技术:Cookie,把数据存储到客户端 服务器端会话技术:Session,把数据存储到服务器端 Cookie 概念:客户端会话技术,将数据存储到客户端 快速入门: 使用步骤: 创建C
程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆  每天早上8:30推送 作者| Mr.K   编辑| Emma 来源| 技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯
程序员该看的几部电影
##1、骇客帝国(1999) 概念:在线/离线,递归,循环,矩阵等 剧情简介: 不久的将来,网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂,并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他,现实世界其实是由一个名叫“母体”的计算机人工智能系统控制,人们就像他们饲养的动物,没有自由和思想,而尼奥就是能够拯救人类的救世主。 可是,救赎之路从来都不会一帆风顺,到底哪里才是真实的世界?
蓝桥杯知识点汇总:基础知识和常用算法
文章目录JAVA基础语法:算法竞赛常用的JAVA API:基础算法待更: 此系列包含蓝桥杯所考察的绝大部分知识点,一共有基础语法,常用API,基础算法和数据结构,和往年真题四部分,虽然语言以JAVA为主,但算法部分是相通的,C++组的小伙伴也可以看哦。所有文章的链接都会在此公布,还有很多没有更新,会持续更新,如果大佬发现文章有错误的地方请指正,我会十分感谢。另外,有什么问题可私信我~ JAVA基础
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布了 2019年国民经济报告 ,报告中指出:年末中国大陆总人口(包括31个
实现简单的轮播图(单张图片、多张图片)
前言 刚学js没多久,这篇博客就当做记录了,以后还会完善的,希望大佬们多多指点。ps:下面出现的都是直接闪动,没有滑动效果的轮播图。 单张图片的替换 原理 1.将几张图片叠在一起,通过改变"display:block"和"display:none"这两个属性实现替换。 (前提:在css中给所有图片加上display:none属性) 2.不用将图片叠在一起,将一个div当做"窗口",通过"of
强烈推荐10本程序员在家读的书
很遗憾,这个鼠年春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终
Linux自学篇——linux命令英文全称及解释
man: Manual 意思是手册,可以用这个命令查询其他命令的用法。 pwd:Print working directory 显示当前目录 su:Swith user 切换用户,切换到root用户 cd:Change directory 切换目录 ls:List files 列出目录下的文件 ps:Process Status 进程状态 mk
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
文章目录1. 前言2. 数据下载3. 数据处理4. 数据可视化 1. 前言 今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。 2月6日追记:本文发布后,腾讯的数据源多次变更u
智力题(程序员面试经典)
NO.1  有20瓶药丸,其中19瓶装有1克/粒的药丸,余下一瓶装有1.1克/粒的药丸。给你一台称重精准的天平,怎么找出比较重的那瓶药丸?天平只能用一次。 解法 有时候,严格的限制条件有可能反倒是解题的线索。在这个问题中,限制条件是天平只能用一次。 因为天平只能用一次,我们也得以知道一个有趣的事实:一次必须同时称很多药丸,其实更准确地说,是必须从19瓶拿出药丸进行称重。否则,如果跳过两瓶或更多瓶药
Java与Python学习通法(1)和(2)序言和编程语言发展史怎么学
大家好,我是 jacky 朱元禄,很高兴跟大家一起学习 《Java与Python学习通法系列》。 首先,说一下,我为什么要录这个课; 我们都已经知道Java 和 Python的视频教程和书籍,可以说是非常非常多了,那我录制本系列课的意义是什么呢? (1)课程特色一:我想告诉大家学习编程语言是有捷径的,这个捷径就是 理解技术背后的“哲学逻辑”,或者说是“人文逻辑”,相信你听完 jack
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
阿里架构师花近十年时间整理出来的Java核心知识pdf(Java岗)
由于细节内容实在太多啦,所以只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容! 整理了一份Java核心知识点。覆盖了JVM、锁、并发、Java反射、Spring原理、微服务、Zookeeper、数据库、数据结构等大量知识点。       欢迎大家加入java学习交流社区  点击加入   可获取文中文档       小编推荐:     
Python基础知识点梳理
python基础知识点梳理 摘要: 本文主要介绍一些平时经常会用到的python基础知识点,用于加深印象,也算是对于学习这门语言的一个总结与回顾。python的详细语法介绍可以查看官方编程手册,也有一些在线网站对python语法进行了比较全面的介绍,比如菜鸟教程: python3 教程|菜鸟教程 为了方便聚焦知识点,本文涉及的操作实例并不多,想学好一门语言关键还得自己多编码多实践。 python语
2020年2月全国程序员工资统计,平均工资13716元
趋势 2020年2月,中国大陆程序员平均工资13716元,比上个月增加。具体趋势如图: 各主要程序员城市工资变化 城市 北京,上海,深圳,杭州,广州四地的工资最高。 city 平均工资 最低工资 中位数 最高工资 招聘人数 百分比 北京 18098 3750 15000 45000 20529 9.53% 深圳 16903 5750 15000 37500 30941 14
Java坑人面试题系列: 包装类(中级难度)
Java Magazine上面有一个专门坑人的面试题系列: https://blogs.oracle.com/javamagazine/quiz-2。 这些问题的设计宗旨,主要是测试面试者对Java语言的了解程度,而不是为了用弯弯绕绕的手段把面试者搞蒙。 如果你看过往期的问题,就会发现每一个都不简单。 这些试题模拟了认证考试中的一些难题。 而 “中级(intermediate)” 和 “高级(ad
为什么说程序员做外包没前途?
之前做过不到3个月的外包,2020的第一天就被释放了,2019年还剩1天,我从外包公司离职了。我就谈谈我个人的看法吧。首先我们定义一下什么是有前途 稳定的工作环境 不错的收入 能够在项目中不断提升自己的技能(ps:非技术上的认知也算) 找下家的时候能找到一份工资更高的工作 如果你目前还年轻,但高不成低不就,只有外包offer,那请往下看。 外包公司你应该
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问