Tractor games are widely used tractor games. In some regions, they are also called upgrade or dual-rack games (some people say that the upgrade is different from the tractor). Tractor games change in the basic rules, it is mainly to increase the fun of the game. For example, in some regions, the banker can be pulled from J to 2, or from A to J, Q to 6.
Tractor wars are a tractor game developed using the dotnet framework. It implements the basic rules of tractor games and removes the feature that is the main feature of tractor games, added some rule settings for bright masters and bureaus, as well as selection of bottom-cutting algorithms, mandatory numbers, and selection of purchase rules, you can also use robots to help you play cards and display the current progress.
In terms of the interface, the tractor Wars provide the card back making function. You just need a few clicks to make your favorite digital photos into the card back, you can also enjoy music when playing cards.
For dotnet program developers, you can also use the plug-in mechanism of the tractor war to develop your own plug-in of the licensing algorithm. You only need to implement an algorithm interface, which defines two methods. You only need to implement these two algorithms to complete your own fake algorithms. Interestingly, you can also compete with others to determine which algorithm is better.
The following describes this interface and a simple and illegal algorithm implementation.
If you want to write a tractor algorithm, you need to introduceKuaff. Tractor. Plugins. dllThis accessory containsKuaff. Tractor. Plugins. IuserAlgorithmInterface.
This interface is defined:
Using System; Using System. Collections; Using System. Text; Namespace Kuaff. Tractor. Plugins { Public interface IUserAlgorithm
{
/// <Summary>
/// Algorithm author
/// </Summary>
String Author
{
Get; }
/// <Summary>
/// Email address of the algorithm author
/// </Summary>
String Email
{
Get; }
/// <Summary>
/// Algorithm name
/// </Summary>
String Name
{
Get; }
/// <Summary>
/// Algorithm Introduction
/// </Summary>
String Description
{
Get; }
/// <Summary>
/// The algorithm that begins with a card.
/// </Summary> /// <Param name = "who"> who is the current user? 1: the South, 2: the North, 3: the West, and 4: the East. </param>
/// <Param name = "suit"> current main card color, 1 is red, 2 is black peach, 3 is square, 4 is plum blossom, 5 is King (no master) </param>
/// <Param name = "rank"> current number of times. If 0 is set to 2, 1 is set to 3, and 2 is set to 4 ........ 11 indicates K, 12 indicates A, and 53 indicates king. </param>
/// <Param name = "master"> who is the banker, 1 is the south, 2 is the north, 3 is the West, and 4 is the east? </param>
/// <Param name = "sendCards"> for the cards that have been issued by various teams in the current game, sendCards [0] is the southern house, And sendCards [1] is the northern house, sendCards [2] is West and sendCards [3] is East </param>
/// <Param name = "myCards"> cards in the hands of this user </param>
/// <Returns> </returns>
ArrayList ShouldSendCards (int who, int suit, int rank, int master, String [] sendCards, string myCards );
/// <Summary>
/// Algorithm used to change a card (You are not the first player)
/// </Summary>
/// <Param name = "who"> who is the current user? 1: the South, 2: the North, 3: the West, and 4: the East. </param>
/// <Param name = "suit"> current main card color, 1 is red, 2 is black peach, 3 is square, 4 is plum blossom, 5 is King (no master) </param>
/// <Param name = "rank"> current number of times. If 0 is set to 2, 1 is set to 3, and 2 is set to 4 ........ 11 indicates K, 12 indicates A, and 53 indicates king. </param>
/// <Param name = "master"> who is the banker, 1 is the south, 2 is the north, 3 is the West, and 4 is the east? </param>
/// <Param name = "whoIsFirst"> who issued the first card, 1 for the South, 2 for the North, 3 for the West, and 4 for the East </param>
/// <Param name = "sendCards"> for the cards that have been issued by various teams in the current game, sendCards [0] is the southern house, And sendCards [1] is the northern house, sendCards [2] is West and sendCards [3] is East </param>
/// <Param name = "currentSendCards"> the first card and its home card </param>
/// <Param name = "myCards"> cards in the hands of this user </param>
/// <Returns> </returns>
ArrayList MustSendCards (int who, int suit, int rank, int master, int WhoIsFirst, string [] sendCards, ArrayList [] currentSendCards, string MyCards );
}
} |
It first defines several attributes, which represent the name and email of the algorithm author, the name of the algorithm, and a brief introduction.
The ShouldSendCards method defines the first algorithm to issue a card. For example, when the dongjia card is first issued, ShouldSendCards is called to get the card that dongjia should give. Then MustSendCards is called to get the card that the North family should give, and then MustSendCards is called to get the card that Xi should give, next, call MustSendCards to get the card that nanjia should issue. Then the program calculates the card and obtains the first card next time. Then, use ShouldSendCards to get the first card ...... Continue until the cards in your hands are finished.
Through the introduction in the above section, you also understand the meaning of the MustSendCards method, which is not the first algorithm to be licensed.
The following SampleUserAlgorithm class is a class that implements this interface. Its source code can be obtained in the game's sources directory, and compiled accessories are placed in the plugins directory.All the compiled plug-ins must be placed inPluginsDirectory,The game can read plugins by itselfDll under the fileFile.
This SampleUserAlgorithm class is simple because its first card-picking algorithm is to pick a card, and the card-picking algorithm assumes that the first card is a card, I made a card of this suit. You can complete this plug-in.
Game (including the interface and a simple algorithm implementation source code): Click Here, 2, 3, 4, software version 1.2.0 . 356.
Compile your plug-in into a dll and place it in the game's plugins directory. in the program, you can set a Party to use the algorithm you have compiled, so that you can compete with the built-in algorithm in the program. If your algorithm is invalid (for example, if you have a tractor but you do not have a tractor), your algorithm is not complete, the program automatically changes this algorithm to the built-in algorithm in the program.