位置: IT常识 - 正文

Cursor——ChatGPT的替代品【笔记】(chattr i)

编辑:rootadmin
Cursor——ChatGPT的替代品【笔记】 Cursor——ChatGPT的替代品【笔记】前言推荐Cursor——ChatGPT的替代品下载登录使用高级另外最后前言

推荐整理分享Cursor——ChatGPT的替代品【笔记】(chattr i),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:chat position,chat position,chat position,chattr -u,chattr -u,chat position,chattr -u,chattr -u,内容如对您有帮助,希望把文章链接给更多的朋友!

2023-3-31 22:00:44

以下内容源自《笔记》 仅供学习交流使用

推荐

什么? 你还没用过 Cursor? 智能 AI 代码生成工具 Cursor 安装和使用介绍

Cursor AI IDE 开发者工具

【黑科技】任何人都可以白嫖最强AI!!!

Cursor——ChatGPT的替代品下载

官网下载Cursor

登录

点击设置 点击sign in

可以使用github账号登录

使用

先别打开任何文件,就可以回答问题了

如果回答的是英文,就它让用中文回答 它能回答,编程问题

Cursor——ChatGPT的替代品【笔记】(chattr i)

如何回答,变成以外的问题,请看后面

可以发现,它默认的是python代码

新建一个文件 main,java 输入文件名,敲回车 编写区,Ctrl+L 就写出的是java代码了 怎么让它问答一个编程以外的问题

新建一个hello.txt文件 然后写一个编程之外的问题

测试有可能不成功

提问:写一封情书 提问:西安邮电大学简介

高级

参考 Cursor AI IDE 开发者工具

以下是扫雷程序

import java.util.Scanner;public class Minesweeper { private int[][] grid; private boolean[][] revealed; private boolean[][] mines; private int rows; private int cols; private int numMines; public Minesweeper(int rows, int cols, int numMines) { this.rows = rows; this.cols = cols; this.numMines = numMines; grid = new int[rows][cols]; revealed = new boolean[rows][cols]; mines = new boolean[rows][cols]; placeMines(); calculateNumbers(); } private void placeMines() { int count = 0; while (count < numMines) { int row = (int) (Math.random() * rows); int col = (int) (Math.random() * cols); if (!mines[row][col]) { mines[row][col] = true; count++; } } } private void calculateNumbers() { for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { grid[r][c] = countAdjacentMines(r, c); } } } public void reveal(int row, int col) { if (mines[row][col]) { gameOver(); return; } revealed[row][col] = true; if (grid[row][col] == 0) { for (int r = Math.max(0, row - 1); r <= Math.min(rows - 1, row + 1); r++) { for (int c = Math.max(0, col - 1); c <= Math.min(cols - 1, col + 1); c++) { if (!revealed[r][c]) { reveal(r, c); } } } } } private void gameOver() { System.out.println("Game over!"); System.exit(0); } public boolean isGameOver() { for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { if (mines[r][c] && !revealed[r][c]) { return false; } if (!mines[r][c] && !revealed[r][c]) { return false; } } } return true; } // This method returns the number of adjacent mines for a given cell private int countAdjacentMines(int row, int col) { int count = 0; for (int r = Math.max(0, row - 1); r <= Math.min(rows - 1, row + 1); r++) { for (int c = Math.max(0, col - 1); c <= Math.min(cols - 1, col + 1); c++) { if (mines[r][c]) { count++; } } } return count; }// This method returns the current state of the game as a string // Each cell is represented by a single character // If the cell is not revealed, it is represented by '-' // If the cell is revealed and contains a mine, it is represented by '*' // If the cell is revealed and does not contain a mine, it is represented by the number of adjacent mines public String toString() { StringBuilder sb = new StringBuilder(); for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { if (!revealed[r][c]) { sb.append("-"); } else if (mines[r][c]) { sb.append("*"); } else { sb.append(grid[r][c]); } } sb.append("\n"); } return sb.toString(); } // We need to add a main method to the Minesweeper class to continue the Minesweeper program // In the main method, we can create a new instance of the Minesweeper class and start the game // We can use a Scanner object to get input from the user and call the reveal method with the user's input // We can also use the isGameOver method to check if the game is over and end the game if necessary public static void main(String[] args) { Minesweeper game = new Minesweeper(10, 10, 10); Scanner scanner = new Scanner(System.in); while (!game.isGameOver()) { System.out.println(game.toString()); System.out.print("Enter row and column to reveal: "); int row = scanner.nextInt(); int col = scanner.nextInt(); game.reveal(row, col); } System.out.println(game.toString()); System.out.println("Game over!"); }}

运行结果

以下是GUI编写的扫雷程序

// Import necessary packages// The code provided does not contain any syntax errors that would prevent it from compiling. // If the user is experiencing compilation errors, they should check their Java environment and ensure that all necessary packages and dependencies are properly installed.import javax.swing.*;import java.awt.*;import java.awt.event.*;// Create a Minesweeper class that extends JFrame and implements ActionListenerpublic class Minesweeper extends JFrame implements ActionListener { // Declare necessary variables private Container contentPane; private JPanel gamePanel, buttonPanel; private JButton[][] buttons; private int[][] counts; private int size = 10; private int numMines = 10; // Create a constructor for the Minesweeper class public Minesweeper() { // Set the title of the JFrame setTitle("Minesweeper"); // Get the content pane of the JFrame contentPane = getContentPane(); // Set the layout of the content pane to BorderLayout contentPane.setLayout(new BorderLayout()); // Call the createGamePanel method to create the game panel createGamePanel(); // Call the createButtonPanel method to create the button panel createButtonPanel(); // Pack the JFrame pack(); // Set the JFrame to be visible setVisible(true); } // Create a method to create the game panel private void createGamePanel() { // Create a new JPanel for the game panel gamePanel = new JPanel(); // Set the layout of the game panel to GridLayout gamePanel.setLayout(new GridLayout(size, size)); // Create a new 2D array of JButtons for the buttons buttons = new JButton[size][size]; // Create a new 2D array of integers for the counts counts = new int[size][size]; // Initialize the buttons and counts arrays for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { buttons[i][j] = new JButton(); buttons[i][j].addActionListener(this); gamePanel.add(buttons[i][j]); counts[i][j] = 0; } } // Add the game panel to the content pane contentPane.add(gamePanel, BorderLayout.CENTER); } // Create a method to create the button panel private void createButtonPanel() { // Create a new JPanel for the button panel buttonPanel = new JPanel(); // Set the layout// Set the layout of the button panel to FlowLayout buttonPanel.setLayout(new FlowLayout()); // Create a new JButton for the "New Game" button JButton newGameButton = new JButton("New Game"); // Add an ActionListener to the "New Game" button newGameButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newGame(); } }); // Add the "New Game" button to the button panel buttonPanel.add(newGameButton); // Add the button panel to the content pane contentPane.add(buttonPanel, BorderLayout.SOUTH);// Create a new JButton for the "Reset" button JButton resetButton = new JButton("Reset"); // Add an ActionListener to the "Reset" button resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { reset(); } }); // Add the "Reset" button to the button panel buttonPanel.add(resetButton); // Add the button panel to the content pane contentPane.add(buttonPanel, BorderLayout.SOUTH); // Create a new JButton for the "Settings" button JButton settingsButton = new JButton("Settings"); // Add an ActionListener to the "Settings" button settingsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Call the showSettingsDialog method to show the settings dialog showSettingsDialog(); } }); // Add the "Settings" button to the button panel buttonPanel.add(settingsButton); // Add the button panel to the content pane contentPane.add(buttonPanel, BorderLayout.SOUTH); } // Create a method to generate the mines and update the counts private void generateMines(int row, int col) { // Declare necessary variables int mines = 0; int i, j; // Generate the mines while (mines < numMines) { i = (int)(Math.random() * size); j = (int)(Math.random() * size); if (counts[i][j] != -1 && !(i == row && j == col)) { counts[i][j] = -1; mines++; } } // Update the counts for (i = 0; i < size; i++) { for (j = 0; j < size; j++) { if (counts[i][j] == -1) { updateCounts(i, j); } } } } // Create a method to update the counts private void updateCounts(int row, int col) { // Declare necessary variables int i, j; // Update the counts for (i = row - 1; i <= row + 1; i++) { for (j = col - 1; j <= col + 1; j++) { if (i >= 0 && i < size && j >= 0 && j < size && counts[i][j] != -1) { counts[i][j]++; } } } } // Create a method to reveal the button at the specified row and column private void reveal(int row, int col) { // Check if the button is already revealed or flagged if (buttons[row][col].getText().length() > 0) { return; } // Check if the button contains a mine if (counts[row][col] == -1) { // Reveal all the mines and end the game for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (counts[i][j] == -1) { buttons[i][j].setText("*"); } } } JOptionPane.showMessageDialog(this, "You lose!"); newGame(); return; } // Reveal the button and check if the game is won // Reveal the button and check if the game is won buttons[row][col].setText(Integer.toString(counts[row][col])); if (checkWin()) { JOptionPane.showMessageDialog(this, "You win!"); newGame(); } } // Create a method to check if the game is won private boolean checkWin() { // Declare necessary variables int revealed = 0; // Check if all non-mine buttons are revealed for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (buttons[i][j].getText().length() > 0 || counts[i][j] == -1) { revealed++; } } } if (revealed == size * size) { return true; } return false; } // Create a method to start a new game private void newGame() { // Reset the counts and buttons arrays counts = new int[size][size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { buttons[i][j].setText(""); counts[i][j] = 0; } } // Generate the mines and update the counts generateMines(-1, -1); } // Create a method to reset the game private void reset() { // Reset the counts and buttons arrays for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { buttons[i][j].setText(""); counts[i][j] = 0; } } } private void showSettingsDialog() { // Declare necessary variables JTextField sizeField = new JTextField(Integer.toString(size)); JTextField numMinesField = new JTextField(Integer.toString(numMines)); Object[] message = { "Size:", sizeField, "Number of Mines:", numMinesField }; // Show the settings dialog and update the settings int option = JOptionPane.showConfirmDialog(this, message, "Settings", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { try { int newSize = Integer.parseInt(sizeField.getText()); int newNumMines = Integer.parseInt(numMinesField.getText()); if (newSize > 0 && newSize <= 30 && newNumMines >= 0 && newNumMines < newSize * newSize) { size = newSize; numMines = newNumMines; newGame(); } else { JOptionPane.showMessageDialog(this, "Invalid input!"); } } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "Invalid input!"); } } } // Create an actionPerformed method to handle button clicks public void actionPerformed(ActionEvent e) { // Get the button that was clicked JButton button = (JButton)e.getSource(); // Find the row and column of the button int row = -1, col = -1; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (buttons[i][j] == button) { row = i; col = j; break; } } } // Call the reveal method to reveal the button reveal(row, col); } // Create a main method to create a new Minesweeper object public static void main(String[] args) { new Minesweeper(); } // Create a method to flag the button at the specified row and column private void flag(int row, int col) { // Check if the button is already revealed if (buttons[row][col].getText().length() > 0) { return; } // Check if the button is already flagged if (buttons[row][col].getText().equals("F")) { buttons[row][col].setText(""); return; } // Flag the button buttons[row][col].setText("F"); } // Create a method to handle right-clicks on buttons private void handleRightClick(MouseEvent e) { // Get the button that was clicked JButton button = (JButton)e.getSource(); // Find the row and column of the button int row = -1, col = -1; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (buttons[i][j] == button) { row = i; col = j; break; } } } // Call the flag method to flag the button flag(row, col); } // Override the mousePressed method to handle right-clicks on buttons public void mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { handleRightClick(e); } } // Create a method to handle keyboard events public void keyPressed(KeyEvent e) { // Check if the "r" key is pressed if (e.getKeyCode() == KeyEvent.VK_R) { reset(); } // Check if the "n" key is pressed if (e.getKeyCode() == KeyEvent.VK_N) { newGame(); } // Check if the "s" key is pressed if (e.getKeyCode() == KeyEvent.VK_S) { showSettingsDialog(); } } // Create a method to initialize the game private void initGame() { // Set the size and number of mines size = 10; numMines = 10; // Create the counts and buttons arrays counts = new int[size][size]; buttons = new JButton[size][size]; // Create the game panel gamePanel = new JPanel(); gamePanel.setLayout(new GridLayout(size, size)); // Create the buttons and add them to the game panel for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { buttons[i][j] = new JButton(); buttons[i][j].addActionListener(this); buttons[i][j].addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { handleRightClick(e); } } }); gamePanel.add(buttons[i][j]); } } // Add the game panel to the content pane contentPane.add(gamePanel, BorderLayout.CENTER); // Create the button panel createButtonPanel(); // Generate the mines and update the counts generateMines(-1, -1); }}

运行结果

另外

VSCode软件插件Chatmoss,也可以体验,但是好像有额度。

以下是GUI的扫雷程序

最后

2023-3-31 22:43:31

祝大家逢考必过 点赞收藏关注哦

本文链接地址:https://www.jiuchutong.com/zhishi/299706.html 转载请保留说明!

上一篇:CV:计算机视觉技最强学习路线之CV简介(传统视觉技术/相关概念)、早期/中期/近期应用领域(偏具体应用)、经典CNN架构(偏具体算法)概述、常用工具/库/框架/产品、环境安装、常用数据集、编程技巧(cv计算机视觉定义)

下一篇:Selenium.Webdriver最新语法教程(附Chrome实例演示)

  • 我的电脑(我的电脑)(我的电脑我的文档打不开)

    我的电脑(我的电脑)(我的电脑我的文档打不开)

  • 微信解封复审会成功吗(微信解封复审会被冻结吗多久)

    微信解封复审会成功吗(微信解封复审会被冻结吗多久)

  • 携程打不开 一直在加载(携程打不开 一直转圈圈)

    携程打不开 一直在加载(携程打不开 一直转圈圈)

  • 为什么微信突然用不了了(为什么微信突然要绑定银行卡了)

    为什么微信突然用不了了(为什么微信突然要绑定银行卡了)

  • 手机拔号失败,无法连接到通话网络是什么意思(手机拔号失败如何处理)

    手机拔号失败,无法连接到通话网络是什么意思(手机拔号失败如何处理)

  • qq可以定位好友位置吗(微信好友能定位好友位置吗)

    qq可以定位好友位置吗(微信好友能定位好友位置吗)

  • 华为权益查询在哪(华为权益查询在哪里查)

    华为权益查询在哪(华为权益查询在哪里查)

  • 腾讯会议直播上课老师可以看见学生吗(腾讯会议直播上课能看到学生吗)

    腾讯会议直播上课老师可以看见学生吗(腾讯会议直播上课能看到学生吗)

  • 无法激活面容ID怎么办(无法激活面容id有几种情况)

    无法激活面容ID怎么办(无法激活面容id有几种情况)

  • 淘宝一个黄钻是多少级(淘宝一个黄钻等于几个蓝钻)

    淘宝一个黄钻是多少级(淘宝一个黄钻等于几个蓝钻)

  • 手机微信号被停封了怎么才能找回来(微信号被暂停使用怎么办)

    手机微信号被停封了怎么才能找回来(微信号被暂停使用怎么办)

  • 电话被拉黑了怎样才能联系对方(电话被拉黑了怎么能打通对方电话)

    电话被拉黑了怎样才能联系对方(电话被拉黑了怎么能打通对方电话)

  • 怎么看华为手机保修时间(怎么看华为手机有没有红外线功能)

    怎么看华为手机保修时间(怎么看华为手机有没有红外线功能)

  • 微信消息免打扰还能收到语音通话吗(微信消息免打扰是什么意思)

    微信消息免打扰还能收到语音通话吗(微信消息免打扰是什么意思)

  • 分辨率300dpi是什么意思(分辨率300dpi是什么尺寸)

    分辨率300dpi是什么意思(分辨率300dpi是什么尺寸)

  • 华为p20lite怎么录屏(华为p20lite怎么分屏)

    华为p20lite怎么录屏(华为p20lite怎么分屏)

  • vivo怎么信任软件(vivo手机怎样信任软件)

    vivo怎么信任软件(vivo手机怎样信任软件)

  • 微信怎么样发朋友圈(微信怎么样发朋友圈图片)

    微信怎么样发朋友圈(微信怎么样发朋友圈图片)

  • 快手怎么恢复本地视频(怎样把快手恢复原样)

    快手怎么恢复本地视频(怎样把快手恢复原样)

  • 三摄和二摄区别(三摄一定比双摄好吗)

    三摄和二摄区别(三摄一定比双摄好吗)

  • qq音乐听歌时长在哪看(qq音乐听歌时长可以隐藏吗)

    qq音乐听歌时长在哪看(qq音乐听歌时长可以隐藏吗)

  • 如何在图片上编辑方框(如何在图片上编辑虚线)

    如何在图片上编辑方框(如何在图片上编辑虚线)

  • 备用金征信上传规则(备用金征信上传要多久)

    备用金征信上传规则(备用金征信上传要多久)

  • 抖音如何卖自己商品(抖音如何卖自己的货和挂车)

    抖音如何卖自己商品(抖音如何卖自己的货和挂车)

  • siri叫不出来(平板siri叫不出来)

    siri叫不出来(平板siri叫不出来)

  • 952开头拦截设置(952开头拦截设置 苹果手机)

    952开头拦截设置(952开头拦截设置 苹果手机)

  • Linux 系统内核的调试详解(linux内核有什么作用)

    Linux 系统内核的调试详解(linux内核有什么作用)

  • qtzgacer.exe - qtzgacer进程是什么文件 .作用是什么

    qtzgacer.exe - qtzgacer进程是什么文件 .作用是什么

  • agent.exe是什么进程?agent.exe程序文件介绍 agent.exe会是病毒吗?(agent程序)

    agent.exe是什么进程?agent.exe程序文件介绍 agent.exe会是病毒吗?(agent程序)

  • ps卸载不干净无法安装(ps卸载没反应)

    ps卸载不干净无法安装(ps卸载没反应)

  • 苗圃公司会计分录
  • 购税盘需要什么东西
  • 做账时计提费用不含税怎么取整
  • 技术服务税率是多少 现金
  • 作家以及作品
  • 异地经营如何纳税
  • 应交税金及附加包括哪些
  • 营改增后广告行业税率
  • 企业所得税减免优惠政策
  • 所得税亏损财务处理办法
  • 工程款发票备注栏必须填写吗
  • 商品流通企业进货费用金额较小的计入什么科目
  • 普通的增值税发票可以查询到购买人的信息吗
  • 外贸企业汇兑损益要交所得税吗
  • 银行承兑汇票接收
  • 1000元的打印机双十一满减可以减150吗少
  • 无法登陆wifi怎么登陆路由器
  • 抵债资产会计核算
  • 长期停工的影响
  • 苹果官网
  • php 读取文本文件
  • Sandilands省级森林中被白霜覆盖的番红花,加拿大曼尼托巴 (© Jaynes Gallery/Danita Delimont)
  • 售后回租融资租赁案例
  • 总分机构 分总机构
  • 小规模纳税人免税政策2023年
  • 简单解决微信文案的方法
  • php静态函数
  • 持有至到期投资是什么意思
  • 导入vue.js
  • php如何上传文件
  • 基金管理人应当自与基金销售机构签订销售协议之日起
  • 固定资产加速折旧是什么意思
  • 2022-8-30 servlet
  • 企业应采用
  • 收回已转销的应收账款是什么意思
  • 个人提供翻译服务
  • 未入账的发票可以抵扣吗
  • 专用发票能当月抵扣吗
  • css入门经典
  • 工程施工与工程结算对冲分录
  • 被投资公司注销,投资收益需要交企业所得税你吗
  • 小规模纳税人收普票和专票有什么区别
  • 未开票收入本月要计提增值税吗
  • 进项有效期
  • 公司餐费怎么入账
  • 哪些原始凭证要盖章
  • 厂家给经销商的活动方案怎么写
  • 发放股票股利的意义包括
  • 增值税计入固定资产的成本吗
  • 核定征收需要什么资料
  • 设备维保费如何计算
  • 房地产企业预收账款
  • 累计摊销可以做什么分录
  • 购买500元的保险会计分录
  • 怎么开劳务派遣工作证明
  • 商业银行的固定资产
  • 分享一个简单的故事英语
  • sqlserver临时表 效率
  • 老毛桃winpe系统对注册表信息进行备份的方法
  • ubuntu :wq
  • win10控制面板中没有防火墙
  • 双系统如何迁移到固态硬盘
  • SetPoint.exe - SetPoint是什么进程 有什么用
  • mmc.exe是什么
  • win10 2020h1
  • 批处理基础知识
  • Android Toast设置弹窗大小
  • unity2d shader
  • javascript学习指南
  • shell脚本用法
  • javascript简明教程
  • javascript要打开吗
  • 使用jquery实现的项目
  • js实现文字闪烁的方法
  • python中set用法
  • 河北地税代收工作怎么样
  • 进口消费税怎么入账
  • 小规模纳税人开3%专票怎么交税
  • 天津市东丽区军粮城派出所电话
  • 武汉办房产证契税怎么交
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设