文章目录

  • FourInLine 介绍
  • 游戏逻辑
  • 游戏相关
  • minmax 算法
  • 游戏其他

FourInLine 介绍

简单介绍:a two-player connection game in which the players first choose a color and then take turns dropping colored discs into a seven-column, six-row, vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The object of the game is to connect four of one’s own discs of the same color next to each other vertically, horizontally, or diagonally before your opponent. Four in a Line is a strongly solved game. The first player can always win by playing the right moves.

在线游戏

在这里插入图片描述

游戏逻辑

public class FourInLine {// Declare some constantsstatic int NColumns = 7;static int NRows = 6;// A player is either the red player, or the blue playerpublic static Player redPlayer = Player.redPlayer;public static Player bluePlayer = Player.bluePlayer;// A piece is either a red piece or a blue piecepublic static Piece redPiece = Piece.redPiece;public static Piece bluePiece = Piece.bluePiece;// A column is a list of Pieces.  The first element of the list represents the top of// the column, e.g.// row 6 --// row 5 --// row 4 -- RedPiece   <- first element of the list// row 3 -- RedPiece// row 2 -- BluePiece// row 1 -- RedPiece   <- last element in the list// The list for this column would be [redPiece, redPiece, bluePiece, redPiece]// Now, to add a piece to the TOP of a column, just create a new column// with that piece and append the rest of the old column to it// a Column is a list of piecespublic static class Column extends ArrayList<Piece> {public Column() {}public Column(List<Piece> l) {this.addAll(l);}}// The GameState is a list of Columnspublic static class GameState extends ArrayList<Column> {public GameState() {}public GameState(List<List<Piece>> g) {List<Column> c = g.stream().map(Column::new).collect(toList());this.addAll(c);}}// ColumnNums are 1-based, but list indices are 0-based.  indexOfColumn converts// a ColumnNum to a list index.public static class ColumnNum {int index;public ColumnNum(int index) {GameState s;this.index = index;}public int indexOfColumn() {return index - 1;}public String toString() {return "" + index;}}////   Convert a column to a string of the form "rBrrBB", or "   rrB".  The string//   must have length 6.  If the column is not full, then the list should be//   prefixed with an appropriate number of spaces////   Convert a column to a string of the form "rBrrBB", or "   rrB".  The string//   must have length 6.  If the column is not full, then the list should be//   prefixed with an appropriate number of spacespublic static String showColumn(Column xs) {List<String> blanks = Collections.nCopies( 6 - xs.size(), " ");return String.join("", blanks) +xs.stream().map(Piece::toString).collect(joining(""));}////  Convert a GameState value to a string of the form://  "    r        \n//   r   r   B   r\n//   B B r   B r B\n//   r B r r B r r\n//   r B B r B B r\n//   r B r r B r B"//   Useful functions://     showColumn//       (which you already defined)//     and transposes a list of lists using streams,//       so List(List(1,2,3), List(4,5,6)) becomes List(List(1,4), List(2,5), List(3,6))public static String showGameState(GameState xs) {return IntStream.range(0, NRows).mapToObj(i -> xs.stream().map(l -> showColumn(l)).map(l -> l.charAt(i) + "").collect(joining(" "))).collect(joining("\n"));}// Which pieces belong to which players?public static Piece pieceOf(Player player)  {if (player instanceof Player.RedPlayer)return redPiece;elsereturn bluePiece;}// Given a player, who is the opposing player?public static Player otherPlayer(Player player) {if (player instanceof Player.RedPlayer)return Player.bluePlayer;elsereturn Player.redPlayer;}// Given a piece, what is the colour of the other player's pieces?public static Piece otherPiece(Piece piece) {if (piece instanceof Piece.RedPiece)return bluePiece;elsereturn redPiece;}// The initial GameState, all columns are empty.  Make sure to create the proper// number of columnspublic static GameState initGameState() {GameState game =  new GameState();game.addAll(Collections.nCopies(7, new Column()));return game;}// Check if a column number is valid (i.e. in range)public static boolean isValidColumn(ColumnNum c) {return c.index >= 1 && c.index <= NColumns;}// Check if a column is full (a column can hold at most nRows of pieces)public static boolean isColumnFull(Column column) {return column.size() >= NRows;}// Return a list of all the columns which are not full (used by the AI)public static List<ColumnNum> allViableColumns(GameState game) {return game.stream().filter(c -> !isColumnFull(c)).map(c -> new ColumnNum(game.indexOf(c) + 1)).collect(toList());// another version// return IntStream.range(0, game.size())//         .mapToObj(i -> new AbstractMap.SimpleEntry<>(i, game.get(i).size()))//         .collect(toList()).stream()//         .filter(i -> i.getValue() < 6)//         .map(i -> new ColumnNum(i.getKey() + 1))//         .collect(toList());}// Check if the player is able to drop a piece into a columnpublic static boolean canDropPiece(GameState game, ColumnNum columnN) {return !isColumnFull(game.get(columnN.indexOfColumn()));}// Drop a piece into a numbered column, resulting in a new gamestatepublic static GameState dropPiece(GameState game, ColumnNum columnN, Piece piece) {GameState g = new GameState();Column c = new Column();c.add(piece);c.addAll(game.get(columnN.indexOfColumn()));g.addAll(game);g.set(columnN.indexOfColumn(), c);return g;}// Are there four pieces of the same colour in a column?static boolean fourInCol(Piece piece, Column col) {// 当有四个棋子处于同一列时,游戏就已经结束了,所以只检验每一列从上向下前四个或者前1到5个(对方再下一个)return IntStream.range(0, 2).anyMatch( i -> col.size() > (i+3) && col.subList(i, i + 4).stream().allMatch(piece::equals));// another version 对每列连续同色棋子求和,遇到不同色就把count置0,同色就加1,累加到4保持(防止再次置0)// int reduce = col.stream()//         .mapToInt((p) -> p.equals(piece) ? 1 : 0)//         .reduce(0, (c, p) -> c >= 4 ? c : (p == 1 ? c + 1 : 0));// return reduce >= 4;}public static boolean fourInColumn(Piece piece, GameState game) {return game.stream().anyMatch(c -> fourInCol(piece, c));}// transposes gameboard, assumes all columns are fullstatic GameState transpose(GameState g) {return new GameState(IntStream.range(0, g.get(0).size()).mapToObj(i -> g.stream().map(l -> l.get(i)).collect(toList())).collect(toList()));}// A helper function that fills up a column with pieces of a certain colour.  It// is used to fill up the columns with pieces of the colour that// fourInRow/fourInDiagonal is not looking for.  This will make those functions// easier to define.static Column fillBlank(Piece piece, Column column) {Column result = new Column(Collections.nCopies(NRows - column.size(), piece));result.addAll(column);return result;}// Are there four pieces of the same colour in a row?  Hint: use fillBlanks and// transpose to reduce the problem to fourInColumnpublic static boolean fourInRow(Piece piece, GameState game) {GameState transposed = transpose(new GameState(game.stream().map(c -> fillBlank(otherPiece(piece), c)).collect(toList())));return fourInColumn(piece, transposed);}// Another helper function for fourInDiagonal.  Remove n pieces from the top of// a full column and add blanks (of the colour we're not looking for) to the// bottom to make up the difference.  This makes fourDiagonal easier to define.static Column shift(int n, Piece piece, Column column) {// 从第n个截取,然后在后面加上n个Column c = new Column(column.subList(n, column.size()));c.addAll(Collections.nCopies(n, piece));return c;}// Are there four pieces of the same colour diagonally?  Hint: define a helper// function using structural recursion over the gamestate, and using shift and fourInRow.static boolean fourDiagonalHelper(GameState g, Piece piece) {Piece op = otherPiece(piece);if (g.size() < 4)return false;// 分别上移0,1,2,3格GameState ng = new GameState(Stream.of(g.get(0), shift(1, op, g.get(1)), shift(2, op, g.get(2)), shift(3, op, g.get(3))).collect(toList()));GameState next = new GameState((List)g);// 再向右检查next.remove(0);if (fourInRow(piece, ng))return true;elsereturn fourDiagonalHelper(next, piece);}public static boolean fourDiagonal(Piece piece, GameState game) {Piece op = otherPiece(piece);GameState fullCS = new GameState(game.stream().map(c -> fillBlank(op, c)).collect(toList()));GameState revCS = new GameState();revCS.addAll(fullCS);Collections.reverse(revCS);// 左上->右下 || 右上->左下return fourDiagonalHelper(fullCS, piece) || fourDiagonalHelper(revCS, piece);}// Are there four pieces of the same colour in a line (in any direction)public static boolean fourInALine(Piece piece, GameState game) {return  fourDiagonal(piece, game) || fourInRow(piece, game) || fourInColumn(piece, game);}// Who won the game.  Returns an Optional since it could be that no one has won the// game yet.public static Optional<Player> winner(GameState game) {if (fourInALine(redPiece, game))return Optional.of(redPlayer);else if (fourInALine(bluePiece, game))return Optional.of(bluePlayer);elsereturn Optional.empty();}}

游戏相关

public class Game  {public static void main(String[] args) {// start game loopstartGame();}// A map (similar to a dictionary in Python) that maps// Players to the functions that get moves for those players.  This will// allow us to use the same code for human vs. human matches as for computer// vs. human and computer vs. computer.static class MoveGetterMap extends HashMap<Player, Function<GameState, ColumnNum>> {}// How many moves should the AI look ahead.  Higher numbers mean a smarter AI,// but it takes much longer to evaluate the game tree.static int aiDepth = 4;static ColumnNum lastMove;// UI routinesstatic void startGame() {System.out.println("Welcome to four-in-line");Function<GameState, ColumnNum> redPlayer = getMoveGetter(FourInLine.redPlayer);Function<GameState, ColumnNum> bluePlayer = getMoveGetter(FourInLine.bluePlayer);MoveGetterMap moveGetter = new MoveGetterMap();moveGetter.put(FourInLine.redPlayer, redPlayer);moveGetter.put(FourInLine.bluePlayer, bluePlayer);drawBoard(initGameState());turn(moveGetter, FourInLine.redPlayer, initGameState());}// Execute a single turnstatic void turn(MoveGetterMap moveGetter, Player player, GameState game) {Optional<Player> win = winner(game);if (win.isPresent()) {drawBoard(game);System.out.printf("%s wins!%n", win.get().toString());} else if (allViableColumns(game).isEmpty()) {drawBoard(game);System.out.println("It's a draw!");} else {ColumnNum c = (moveGetter.get(player)).apply(game);lastMove = c;GameState gameP = dropPiece(game, c, pieceOf(player));drawBoard(gameP);turn(moveGetter, otherPlayer(player), gameP);}}// gets a function that gets the next move for a particular player.// Depending on whether the player is human or computer, it will be// getHumanMove player, or getComputerMove playerstatic  Function<GameState, ColumnNum> getMoveGetter(Player player) {System.out.printf("Is %s to be human or computer? ", player);Scanner scanner = new Scanner(System.in);String ln = scanner.nextLine().trim();if (ln.equals("computer")) {return aiMove(aiDepth, player);} else if (ln.equals("human")) {return getHumanMove(player);} else {System.out.println("Input must be either \"human\" or \"computer\"");return getMoveGetter(player);}}static ColumnNum getValidMove(GameState game) {ColumnNum c = getMove();if (!canDropPiece(game, c)) {System.out.printf("Column %s is full, try again.%n", c);return getValidMove(game);} elsereturn c;}static ColumnNum getMove() {Scanner scanner = new Scanner(System.in);String ln = scanner.nextLine().trim();Optional<ColumnNum> c = getColumn(ln);if (c.isPresent()) {if (!isValidColumn(c.get()))  {System.out.println("No such column, try again.");System.out.println("Enter column number: ");getMove();}} else {System.out.println("That wasn't a number. Enter column number: ");getMove();}return c.get();}// Read a valid movestatic Function<GameState, ColumnNum> getHumanMove(Player player)  {return game -> {System.out.printf("%s's turn. Enter column number: ", player);return getValidMove(game);};}// Parse a column number from a stringstatic Optional<ColumnNum> getColumn(String str) {String c = str.trim();try {return Optional.of(new ColumnNum(Integer.parseInt(c)));} catch (Exception e){return Optional.empty();}}// Draw the game boardstatic void drawBoard(GameState gameState) {String[] strLines = showGameState(gameState).split("\n");List<Integer> c = Arrays.asList(6, 5, 4, 3, 2, 1);System.out.print(" ");for(int i = 1; i <= 7; i++) {if (lastMove != null && lastMove.index == i)System.out.printf("%s*", i); // highlight last played columnelseSystem.out.printf("%s ", i);}System.out.println("");for(Integer i: c) {System.out.printf("%s %s%n", i, strLines[6 - i]);}}
}

minmax 算法

public class GameTree {static class Tree {GameState game;List<Move> moves;public Tree(GameState g, List<Move> m) {game = g;moves = m;}}static class Move {ColumnNum move;Tree tree;public Move(ColumnNum m, Tree t) {move = m;tree = t;}}static Move subGameTree(GameState game, ColumnNum c, Player player, int depth) {return new Move(c, gameTree(otherPlayer(player),depth - 1, dropPiece(game, c, pieceOf(player))));}// Recursively build the game tree using allViableColumns to get all possible// moves (introduce depth as the function is not lazy).  Note that the tree bottoms out once the game is wonstatic Tree gameTree(Player player, int depth, GameState game)  {Optional<Player> w = winner(game);if (w.isPresent()) {return new Tree(game, new ArrayList<>());} else if (depth == 0) {return new Tree(game, new ArrayList<>());} else {List<Move> moves = allViableColumns(game).stream().map(n -> {return subGameTree(game, n, player, depth);}).collect(toList());return new Tree(game, moves);}}//Estimate the value of a position for a player. This implementation only//assigns scores based on whether or not the player has won the game.  This is//the simplest possible way of doing it, but it results in an//overly-pessimistic AI.////The "cleverness" of the AI is determined by the sophistication of the//estimate function.//Some ideas for making the AI smarter://1) A win on the next turn should be worth more than a win multiple turns//later.  Conversely, a loss on the next turn is worse than a loss several//turns later.//2) Some columns have more strategic value than others.  For example, placing//pieces in the centre columns gives you more options.//3) It's a good idea to clump your pieces together so there are more ways you//could make four in a line.static int estimate(Player player, GameState game) {if (fourInALine(pieceOf(player), game))return 100;else if (fourInALine(pieceOf(otherPlayer(player)), game))return -100;elsereturn 0;}static ColumnNum maxmini(Player player, Tree tree)  {if (tree.moves.isEmpty())throw new RuntimeException("The AI was asked to make a move, but there are no moves possible.  This cannot happen");else {return  tree.moves.stream().collect(Collectors.maxBy((Move a, Move b) -> {return minimaxP(player, a.tree) - minimaxP(player, b.tree);})).get().move;}}// Maximise the minimum utility of player making a move.  Do this when it is the// player's turn to find the least-bad move, assuming the opponent will play// perfectly.static int maxminiP(Player player, Tree tree) {if (tree.moves.isEmpty())return estimate(player, tree.game);else {return Collections.max(tree.moves.stream().map(m -> minimaxP(player, m.tree)).collect(toList()));}}// Minimise the maximum utility of player making a move.  Do this when it is the// opponent's turn, to simulate the opponent choosing the move that results in// the least utility for the player.static int minimaxP(Player player, Tree tree) {if (tree.moves.isEmpty())return estimate(player, tree.game);else {return Collections.min(tree.moves.stream().map(m -> maxminiP(player, m.tree)).collect(toList()));}}// Determine the best move for computer playerpublic static Function<GameState, ColumnNum> aiMove(int lookahead, Player player) {return x -> {return maxmini(player,gameTree(player, lookahead, x));};}}

游戏其他

public abstract class Piece {private String name;public static RedPiece redPiece = new RedPiece();public static BluePiece bluePiece = new BluePiece();public String toString() {return name;}public Piece(String name) {this.name = name;}public static final class RedPiece extends Piece {private RedPiece() {super("r");}}public static final class BluePiece extends Piece {private BluePiece() {super("B");}}
}public abstract class Player {private String name;public static RedPlayer redPlayer = new RedPlayer();public static BluePlayer bluePlayer = new BluePlayer();public String toString() {return name;}public Player(String name) {this.name = name;}public static final class RedPlayer extends Player {private RedPlayer() {super("Red Player");}}public static final class BluePlayer extends Player {private BluePlayer() {super("Blue Player");}}}
查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. Java static的内存图

    1.static运行 JVM可分为四个区:堆区、栈区、数据区、代码区 类进入到方法区后,先加载自己的静态成员,main也是静态的,main是属于Test类,静态属于自己的类 程序开始执行,运行main(),JVM到静态区将main方法复制一份压栈执行 内存中,静态优先于非静态存在2.static特点 被s…...

    2024/4/16 10:06:34
  2. sql学习相关总结

    数据库基本命令登录: mysql -u 用户 -p 创建数据库:create database 库名 default charset=utf8 查看所有库:show databases; 此处;不能少 使用特定的库:use 库名; 删除库:drop database 库名; 查看一个库中的所有表:show tables; 创建一张表:create table if not exist…...

    2024/4/16 10:06:09
  3. 基于SpringBoot的后台管理系统(2)登录权限控制模块

    登录权限控制模块1、Shiro框架简单介绍2、Shiro安全框架工程配置2.1、依赖的包2.2、配置文件shiroConfig2.3、自定义验证器shiroRealm3、登录拦截器loginController4、测试4.1、正常登录测试4.2、记住登录测试 1、Shiro框架简单介绍 Apache Shiro是Java的一个安全框架,旨在简化…...

    2024/4/21 14:59:21
  4. kubernetes(3)pod控制器

    文章目录kubernetes(3)pod控制器Pod和Pod控制器Pod控制器概述控制器的意义常见的工作负载控制器 kubernetes(3)pod控制器 Pod和Pod控制器Pod控制器资源通过持续性地监控集群中运行着的Pod资源对象来确保受其管控的资源严格符合用户期望的状态,例如资源副本的数量要精确符合…...

    2024/4/16 10:07:20
  5. Javaweb---网络(5)

    实现HTTP服务器(版本1): 基本框架:...

    2024/4/17 22:02:43
  6. 【值得收藏】如何用RabbitMQ来实现一个可复用的分布式事务消息架构完美方案?

    前提 分布式事务是微服务实践中一个比较棘手的问题,在笔者所实施的微服务实践方案中,都采用了折中或者规避强一致性的方案。参考Ebay多年前提出的本地消息表方案,基于RabbitMQ和MySQL(JDBC)做了轻量级的封装,实现了低入侵性的事务消息模块。本文的内容就是详细分析整个方…...

    2024/4/20 8:18:20
  7. Kubernetes(4)deployment管理pod

    文章目录Kubernetes(4)deployment管理poddeployment管理pod命令vs配置文件伸缩Failover情况用label控制Pod的位置 Kubernetes(4)deployment管理podkubernetes cluster由master和node组成master节点是kubernetes cluster的大脑,它同时也是一个node 1.API Server(k8s.gcr.io/kub…...

    2024/4/17 10:01:41
  8. C++比C多了什么(二)

    1.6 函数重载 1.6.1 函数重载的概念 一个函数名可以对应多个函数体(多个接口),--------->函数重载 对功能相近的函数,写成函数重载 1.6.2 函数重载的作用可以使一个函数在不同的条件下,执行不同的功能,提高了函数功能性 避免为多个功能相近但是不同代码起名出现名称冲…...

    2024/4/16 10:08:01
  9. Kubernetes(5)job控制器

    文章目录Kubernetes(5)job控制器部署job的并行性定时Job Kubernetes(5)job控制器容器按照持续运行的时间可分为两类:服务类容器和工作类容器 服务类容器通常持续提供服务,需要一直运行,比如HTTPServer、Daemon等。工作类容器则是一次性任务,比如批处理程序,完成后容器就退出 Ku…...

    2024/4/16 10:07:15
  10. day05 MySQL的约束

    1.1约束的理解1.2非空约束1.3唯一性约束1.4主键约束主键值自增1.5外键约束...

    2024/4/20 12:39:31
  11. 索尼Xperia XZ1拆机换上听筒和电池

    前言 这是我第二次拆手机。 前几年Lumia900也拆机换过电池,但貌似那款手机挺好拆,屏幕撬开就可以换了。但XZ1换电池需要把主板都拆下来,等于是把手机95%都卸下来才可以换,真是想换但又害怕搞死,毕竟自我感觉动手能力不弱,但是总是爱用蛮力。 过来人警告 如果想换上下听筒…...

    2024/4/16 10:07:20
  12. Kubernetes(6)service访问pod

    文章目录Kubernetes(6)service访问pod作用和概念三种IPService 类型创建ServiceCluster IP底层实现DNS访问Service外网如何访问Service实践NodePort Kubernetes(6)service访问pod 作用和概念我们不应该期望Kubernetes Pod是健壮的,而是要假设Pod中的容器很可能因为各种原因发生…...

    2024/4/20 14:48:24
  13. 烽火计划项目成果-目录索引

    烽火计划项目成果-目录索引 制作:咸某人 目录2019-秋编译原理复习提纲操作系统复习提纲马原复习提纲人工智能导论复习提纲数据结构复习提纲数值分析复习提纲2020-夏随机过程复习提纲计算机网络习题集计算类概念类数据库系统原理教材汉化专有名词速查表第三章作业汉化第四章作业…...

    2024/4/16 10:07:15
  14. Vue 的数据响应式原理

    一、理解Vue的设计思想MVVM框架的三要素:数据响应式、模板引擎及其渲染 (1) 数据响应式:监听数据变化并在视图中更新Object.defineProperty()Proxy (2) 模版引擎:提供描述视图的模版语法插值:{{}}指令:v-bind,v-on,v-model,v-for,v-if (3) 渲染:如何将模板转换为html模板 =…...

    2024/4/16 10:07:05
  15. 小猫爬山

    翰翰和达达饲养了N只小猫,这天,小猫们要去爬山。 经历了千辛万苦,小猫们终于爬上了山顶,但是疲倦的它们再也不想徒步走下山了(呜咕>_<)。 翰翰和达达只好花钱让它们坐索道下山。 索道上的缆车最大承重量为W,而N只小猫的重量分别是C1、C2……CNC1、C2……CN。 当然…...

    2024/4/16 10:06:50
  16. macos(10.15.5 catalina)安装Php zip扩展时cannot find .config.m4问题的处理

    php项目需要安装zip扩展,从 http://pecl.php.net/get/zip 下载下zip包后(我下载的是zip-1.19.0),按照http://www.manongjc.com/detail/14-mtgokqdndcunopp.html大神的文章开始安装,当只想phpize命令时,并没有出现需要安装autoconfig的提示,而是出现: connot find config.m…...

    2024/4/16 10:06:29
  17. 蚂蚁国的交通问题

    有一根长度为L厘米的细木杆,现有n只蚂蚁在细木杆上,这n只蚂蚁的初始位置分别距离细木杆的左端第a1、a2、a3、……、an厘米处,木杆很细,不能同时通过两只蚂蚁。开始时,蚂蚁的头朝左还是朝右是任意的,它们只会朝前走或调头,但不会后退,当任意两只蚂蚁碰头时,两只蚂蚁会同…...

    2024/4/20 10:28:28
  18. 【数据结构基础】

    文章目录...

    2024/4/19 21:27:05
  19. pytorch编程提示

    1、卷积层编程要点画圈参数需要仔细琢磨。 2、代码 完整的MNIST数据集5层神经网络代码,CPU跑用时221.5秒,GPU加速用时19秒。 import torch import torchvision as tv import time"导入数据"def load_data(batch=500):train_set = torch.utils.data.DataLoader(tv.d…...

    2024/4/18 15:19:32
  20. 剑指offer之二叉树中和为某一值的路径(C++)

    #题目请在这里输入输入一颗二叉树的根节点和一个整数,按字典序打印出二叉树中结点值的和为输入整数的所有路径。路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。思路思路很简单,但是说起来很费劲,贴个链接吧:https://blog.csdn.net/niqian6005/arti…...

    2024/4/17 10:03:44

最新文章

  1. 基于家政小程序的个性化家政服务研究

    基于家政小程序的个性化家政服务研究&#xff0c;是近年来随着移动互联网技术的快速发展和人们生活品质的提高而兴起的一个热门话题。以下是对该领域的研究探讨&#xff1a; 一、引言 随着现代生活节奏的加快&#xff0c;家政服务已成为越来越多家庭不可或缺的一部分。然而&a…...

    2024/5/6 14:28:00
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/5/6 9:38:23
  3. Go语言map、slice、channel底层实现(go面试)

    slice 切片是一个引用类型&#xff0c;其底层实现是一个结构体&#xff0c;包含以下字段&#xff1a; ptr&#xff1a;一个指向底层数组的指针&#xff0c;指针指向数组的第一个元素。 len&#xff1a;切片当前包含的元素数量。 cap&#xff1a;切片的容量&#xff0c;即底层…...

    2024/5/5 1:45:06
  4. 【干货】零售商的商品规划策略

    商品规划&#xff0c;无疑是零售业的生命之源&#xff0c;是推动业务腾飞的强大引擎。一个精心策划的商品规划策略&#xff0c;不仅能帮助零售商在激烈的市场竞争中稳固立足&#xff0c;更能精准捕捉客户需求&#xff0c;实现利润最大化。以下&#xff0c;我们将深入探讨零售商…...

    2024/5/5 12:33:12
  5. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/4 23:54:56
  6. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/4 23:54:56
  7. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/5/4 23:54:56
  8. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/6 9:21:00
  9. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/5/4 23:54:56
  10. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/5/4 23:55:05
  11. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/5/4 23:54:56
  12. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/5/4 23:55:16
  13. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/5/4 23:54:56
  14. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/6 1:40:42
  15. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/5/4 23:54:56
  16. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/5/4 23:55:17
  17. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/5/4 23:55:06
  18. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/5/4 23:54:56
  19. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/4 23:55:06
  20. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/5/5 8:13:33
  21. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/5/4 23:55:16
  22. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/5/4 23:54:58
  23. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/4 23:55:01
  24. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/5/4 23:54:56
  25. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  26. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  27. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  28. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  29. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  30. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  31. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  32. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  33. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  34. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  35. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  36. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  37. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  38. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  39. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  40. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  41. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  42. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  43. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  44. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57