写完排行榜了
This commit is contained in:
@@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using CDSAE3_Lian_Lian_Kan;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
|
||||
namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
{
|
||||
public partial class Board:IBoard
|
||||
@@ -24,7 +17,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
{
|
||||
total = value;
|
||||
if (Total == 0)
|
||||
Etcs.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
||||
Etcs.gameModeForm?.Finished_Handler(this, new FinishArgs { finish_Type = FinishArgs.Finish_Type.All_done });
|
||||
}
|
||||
}
|
||||
private Board_funcs board_Funcs = new Board_funcs();
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
internal class Board_funcs
|
||||
{
|
||||
private Random random = new Random();
|
||||
internal int getval(ref int[] temp_val_per_Image,ref int last_val,int types)
|
||||
internal int getval(ref int[] temp_val_per_Image, ref int last_val, int types)
|
||||
{
|
||||
int not_zero = 0;
|
||||
foreach (int x in temp_val_per_Image)
|
||||
@@ -45,14 +45,14 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
last_val = t;
|
||||
return t;
|
||||
}
|
||||
internal int[] get_vals_per_image(int total,int type_num)
|
||||
internal int[] get_vals_per_image(int total, int type_num)
|
||||
{
|
||||
int[] vals_per_Image= new int[type_num];
|
||||
int[] vals_per_Image = new int[type_num];
|
||||
int single = total / type_num;
|
||||
for (int k = total; k > 0; k -= 2)
|
||||
{
|
||||
int t = random.Next(0, type_num);
|
||||
if (vals_per_Image[t] >= 1.5 * single)
|
||||
if (vals_per_Image[t] >= 1.5 * single && single != 0)
|
||||
{
|
||||
k += 2;
|
||||
continue;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
|
||||
|
||||
namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
{
|
||||
@@ -47,7 +48,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
{
|
||||
total = value;
|
||||
if (Total == 0)
|
||||
Etcs.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
||||
Etcs.gameModeForm?.Finished_Handler(this, new FinishArgs { finish_Type = FinishArgs.Finish_Type.All_done });
|
||||
}
|
||||
}
|
||||
private int[] Vals_per_Image { get; set; } = Array.Empty<int>();
|
||||
@@ -103,9 +104,13 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
Index.Add((j, i), new Node(j, i, -1));
|
||||
}
|
||||
|
||||
bool doSwap_causeByOddtotal = false;
|
||||
int sum = width * height;
|
||||
if (sum % 2 != 0)
|
||||
{
|
||||
doSwap_causeByOddtotal = true;
|
||||
sum--;
|
||||
}
|
||||
total = sum;
|
||||
int types = Etcs.Images_size();
|
||||
Vals_per_Image = board_Funcs.get_vals_per_image(Total, types);
|
||||
@@ -127,6 +132,8 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||
cur_width = 1;
|
||||
}
|
||||
}
|
||||
if (doSwap_causeByOddtotal)
|
||||
(Bd[height, width], Bd[(height + 1) / 2, (width + 1) / 2]) = (Bd[(height + 1) / 2, (width + 1) / 2], Bd[height, width]);
|
||||
foreach(var (index,node)in Index)
|
||||
{
|
||||
if (Index.TryGetValue((node.x - 1, node.y), out var lnode))
|
||||
|
||||
Reference in New Issue
Block a user