Cursor——ChatGPT的替代品【笔记】

Cursor——ChatGPT的替代品【笔记】

  • 前言
  • 推荐
  • Cursor——ChatGPT的替代品
    • 下载
    • 登录
    • 使用
    • 高级
    • 另外
  • 最后

前言

2023-3-31 22:00:44

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

推荐

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

Cursor AI IDE 开发者工具

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

Cursor——ChatGPT的替代品

下载

官网下载Cursor
在这里插入图片描述

登录

点击设置
点击sign in
在这里插入图片描述

可以使用github账号登录

使用

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

如果回答的是英文,就它让用中文回答
在这里插入图片描述
在这里插入图片描述
它能回答,编程问题

在这里插入图片描述
如何回答,变成以外的问题,请看后面
在这里插入图片描述

可以发现,它默认的是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 cellprivate 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 minespublic 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 necessarypublic 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 ActionListener
public class Minesweeper extends JFrame implements ActionListener {// Declare necessary variablesprivate 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 classpublic Minesweeper() {// Set the title of the JFramesetTitle("Minesweeper");// Get the content pane of the JFramecontentPane = getContentPane();// Set the layout of the content pane to BorderLayoutcontentPane.setLayout(new BorderLayout());// Call the createGamePanel method to create the game panelcreateGamePanel();// Call the createButtonPanel method to create the button panelcreateButtonPanel();// Pack the JFramepack();// Set the JFrame to be visiblesetVisible(true);}// Create a method to create the game panelprivate void createGamePanel() {// Create a new JPanel for the game panelgamePanel = new JPanel();// Set the layout of the game panel to GridLayoutgamePanel.setLayout(new GridLayout(size, size));// Create a new 2D array of JButtons for the buttonsbuttons = new JButton[size][size];// Create a new 2D array of integers for the countscounts = new int[size][size];// Initialize the buttons and counts arraysfor (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 panecontentPane.add(gamePanel, BorderLayout.CENTER);}// Create a method to create the button panelprivate void createButtonPanel() {// Create a new JPanel for the button panelbuttonPanel = new JPanel();// Set the layout// Set the layout of the button panel to FlowLayoutbuttonPanel.setLayout(new FlowLayout());// Create a new JButton for the "New Game" buttonJButton newGameButton = new JButton("New Game");// Add an ActionListener to the "New Game" buttonnewGameButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {newGame();}});// Add the "New Game" button to the button panelbuttonPanel.add(newGameButton);// Add the button panel to the content panecontentPane.add(buttonPanel, BorderLayout.SOUTH);// Create a new JButton for the "Reset" buttonJButton resetButton = new JButton("Reset");// Add an ActionListener to the "Reset" buttonresetButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {reset();}});// Add the "Reset" button to the button panelbuttonPanel.add(resetButton);// Add the button panel to the content panecontentPane.add(buttonPanel, BorderLayout.SOUTH);// Create a new JButton for the "Settings" buttonJButton settingsButton = new JButton("Settings");// Add an ActionListener to the "Settings" buttonsettingsButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {// Call the showSettingsDialog method to show the settings dialogshowSettingsDialog();}});// Add the "Settings" button to the button panelbuttonPanel.add(settingsButton);// Add the button panel to the content panecontentPane.add(buttonPanel, BorderLayout.SOUTH);}// Create a method to generate the mines and update the countsprivate void generateMines(int row, int col) {// Declare necessary variablesint mines = 0;int i, j;// Generate the mineswhile (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 countsfor (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 countsprivate void updateCounts(int row, int col) {// Declare necessary variablesint i, j;// Update the countsfor (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 columnprivate void reveal(int row, int col) {// Check if the button is already revealed or flaggedif (buttons[row][col].getText().length() > 0) {return;}// Check if the button contains a mineif (counts[row][col] == -1) {// Reveal all the mines and end the gamefor (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 wonbuttons[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 wonprivate boolean checkWin() {// Declare necessary variablesint revealed = 0;// Check if all non-mine buttons are revealedfor (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 gameprivate void newGame() {// Reset the counts and buttons arrayscounts = 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 countsgenerateMines(-1, -1);}// Create a method to reset the gameprivate void reset() {// Reset the counts and buttons arraysfor (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 variablesJTextField 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 settingsint 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 clickspublic void actionPerformed(ActionEvent e) {// Get the button that was clickedJButton button = (JButton)e.getSource();// Find the row and column of the buttonint 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 buttonreveal(row, col);}// Create a main method to create a new Minesweeper objectpublic static void main(String[] args) {new Minesweeper();}// Create a method to flag the button at the specified row and columnprivate void flag(int row, int col) {// Check if the button is already revealedif (buttons[row][col].getText().length() > 0) {return;}// Check if the button is already flaggedif (buttons[row][col].getText().equals("F")) {buttons[row][col].setText("");return;}// Flag the buttonbuttons[row][col].setText("F");}// Create a method to handle right-clicks on buttonsprivate void handleRightClick(MouseEvent e) {// Get the button that was clickedJButton button = (JButton)e.getSource();// Find the row and column of the buttonint 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 buttonflag(row, col);}// Override the mousePressed method to handle right-clicks on buttonspublic void mousePressed(MouseEvent e) {if (SwingUtilities.isRightMouseButton(e)) {handleRightClick(e);}}// Create a method to handle keyboard eventspublic void keyPressed(KeyEvent e) {// Check if the "r" key is pressedif (e.getKeyCode() == KeyEvent.VK_R) {reset();}// Check if the "n" key is pressedif (e.getKeyCode() == KeyEvent.VK_N) {newGame();}// Check if the "s" key is pressedif (e.getKeyCode() == KeyEvent.VK_S) {showSettingsDialog();}}// Create a method to initialize the gameprivate void initGame() {// Set the size and number of minessize = 10;numMines = 10;// Create the counts and buttons arrayscounts = new int[size][size];buttons = new JButton[size][size];// Create the game panelgamePanel = new JPanel();gamePanel.setLayout(new GridLayout(size, size));// Create the buttons and add them to the game panelfor (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 panecontentPane.add(gamePanel, BorderLayout.CENTER);// Create the button panelcreateButtonPanel();// Generate the mines and update the countsgenerateMines(-1, -1);}}

运行结果
在这里插入图片描述

另外

VSCode软件插件Chatmoss,也可以体验,但是好像有额度。
在这里插入图片描述

以下是GUI的扫雷程序


最后

2023-3-31 22:43:31

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/7978.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ChatGPT可以替代人类做哪些工作?

随着时代不断发展&#xff0c;人工智能技术正在日益发展&#xff0c;越来越多的人工智能技术正在改变人们的生活。其中&#xff0c;Chat GPT&#xff08;Generative Pre-trained Transformer&#xff09;也是一种新型的机器学习技术&#xff0c;可以替代人类做一些繁琐的工作。…

全网最详细中英文ChatGPT-GPT-4示例文档-从0到1快速入门多语种翻译应用场景——官网推荐的48种最佳应用场景(附python/node.js/curl命令源代码,小白也能学)

List item 从0到1快速入门多语种翻译应用场景 Introduce 简介setting 设置Prompt 提示Sample response 回复样本API request 接口请求python接口请求示例node.js接口请求示例curl命令示例json格式示例 其它资料下载 ChatGPT是目前最先进的AI聊天机器人&#xff0c;它能够理解图…

DeepSpeed ZeRO++:降低4倍网络通信,显著提高大模型及类ChatGPT模型训练效率

点击蓝字 关注我们 关注并星标 从此不迷路 计算机视觉研究院 公众号ID&#xff5c;计算机视觉研究院 学习群&#xff5c;扫码在主页获取加入方式 计算机视觉研究院专栏 Column of Computer Vision Institute 大型AI模型正在改变数字世界。基于大型语言模型 (LLM) 的 Turing-NLG…

让你的类ChatGPT千亿大模型提速省钱15倍,微软开源 DeepSpeed-Chat

作者 | 微软 DeepSpeed 开源项目组 来源 | 开源社&#xff08;中文版授权开源社首发&#xff09; 概述 近日来&#xff0c;ChatGPT 及类似模型引发了人工智能&#xff08;AI&#xff09;领域的一场风潮。这场风潮对数字世界产生了革命性影响。ChatGPT 类模型具有惊人的泛用性&a…

ChatGPT和 dalle2 配合生成故事绘本

和 dalle2 配合生成故事绘本 在之前章节中&#xff0c;我们已经尝试过让 ChatGPT 来生成一些故事情节&#xff0c;不管是影视剧还是小说还是游戏都可以。这时候&#xff0c;自然而然的可以联想到&#xff1a;那我们可不可以一步到位&#xff0c;把 ChatGPT 编出来的故事情节&a…

科研工具-论文写作翻译软件优缺点介绍

当今&#xff0c;科研学习已经成为人们生活中不可或缺的一部分&#xff0c;而随着全球化的发展&#xff0c;跨语言沟通也变得越来越重要。翻译软件因此也变得越来越普及。针对科研学习中的翻译需求&#xff0c;目前市面上涌现了许多优秀的翻译软件&#xff0c;它们可以辅助我们…

DeepSpeed-Chat 打造类ChatGPT全流程 笔记二之监督指令微调

文章目录 系列文章0x0. 前言0x1. &#x1f415; Supervised finetuning (SFT) 教程翻译&#x1f3c3; 如何训练模型&#x1f3c3; 如何对SFT checkpoint进行评测?&#x1f481; 模型和数据☀️来自OPT-1.3B及其SFT变体&#xff08;使用不同微调数据&#xff09;的提示示例☀️…

chatpdf使用说明

传送门&#xff1a;https://www.chatpdf.com/ chatpdf是一个可以让你与PDF文件进行对话的工具&#xff0c;它可以帮助你快速提取PDF文件中的信息&#xff0c;例如手册、论文、合同、书籍等。 要使用chatpdf&#xff0c;你需要先访问它的网站&#xff0c;并点击“Upload PDF”…

又一巨头宣布入局AIGC,一口气开源数个模型,还道出了它的变现之道

金磊 发自 凹非寺量子位 | 公众号 QbitAI AIGC&#xff08;AI生成内容&#xff09;&#xff0c;这个概念在今年可以说是火得一塌糊涂。 例如Stable Diffusion&#xff0c;只要对它说一句话&#xff0c;“唰唰唰”地就能秒生成画作。 再如最近大火的ChatGPT&#xff0c;对答如流…

全面开放!Google Bard使用教程

一 前言 在2002.5.12举办的Google I/O发布会上&#xff0c;Google宣布从即日起将Bard全面开放&#xff0c;全球超过180个国家只要点击进入bard.google.com&#xff0c;无需等候就能使用。 Bard有哪些特点&#xff1f;通过与ChatGPT的对比&#xff0c;就可以很快地了解Bard&am…

【研究】CSDN 到底是怎么套壳 ChatGPT 的?稍微研究了一下提示词

昨天 CSDN 宣布推出自研的一款 AI 聊天助手“ChitGPT”&#xff0c;定位是“专门为开发者设计的大型语言模型&#xff0c;能解决例如代码生成(用 js 写一个冒泡排序)&#xff0c;代码错误追踪等问题”。 但是相信大家也知道了&#xff0c;只要问它“Who are you?”&#xff0…

Science:AI竞赛,学界正在输给业界

【编者按】人工智能&#xff08;AI&#xff09;正在向业界倾斜。相比于学界的前沿性研究&#xff0c;风靡当下的 AI 聊天机器人 ChatGPT、AI 艺术生成器 Midjourney&#xff0c;以及微软发布的新一代 AI 驱动搜索引擎 New Bing、谷歌发布 ChatGPT 竞品 Bard 和那些未来将要发布…

A Survey on Evaluation of Large Language Models

这是LLM相关的系列文章&#xff0c;针对《A Survey on Evaluation of Large Language Models》的翻译。 大型语言模型评价综述 摘要1 引言2 背景2.1 大语言模型2.2 AI模型评估 3 评估什么3.1 自然语言处理任务3.1.1 自然语言理解3.1.2 推理3.1.3 自然语言生成3.1.4 多语言任务…

深度长文|详解现象级ChatGPT发展历程、原理、技术架构详解和产业未来

来源&#xff1a;工业互联网研习社 作者&#xff1a;陈巍博士&#xff0c;曾担任华为系自然语言处理&#xff08;NLP&#xff09;企业的首席科学家&#xff0c;文章首发于「先进AI技术深入解读」 工业互联网浪潮来袭&#xff0c;你准备好了吗&#xff1f; 每一代GPT模型的参数量…

一个 ChatGPT,还能养活多少 AI 新老板?

内容一览&#xff1a;当下&#xff0c;国内 AI 创业十分火爆&#xff0c;截止目前加入这个阵营的已有贾扬清等多位明星创业者。然而&#xff0c;这次 ChatGPT 的出现能否打破国内 AI 公司缺少规模化落地的创业「魔咒」&#xff1f; 本文首发自 HyperAI超神经微信公众号~ 刚刚过…

爆火的 ChatGPT 太强了!写代码、改 bug,网友:可取代 Stack Overflow 了

OpenAI 新上线的 ChatGPT 可谓是火爆出圈&#xff0c;这个对话模型可以回答后续问题&#xff0c;承认错误&#xff0c;挑战不正确的前提&#xff0c;还能帮你修改代码中的 bug…… 只要和它聊上几句&#xff0c;一会儿功夫它就能把问题给你解决了。例如用户要求&#xff1a;「C…

you-get: 用户账户异常、请重新登录

刚开始还能下载的&#xff0c;后面就不行了&#xff0c;一直出现这个异常。不知道什么原因&#xff1f;无法解决&#xff0c;求助各位&#xff01;

万字干货!ChatGPT 从零完全上手实操指南!(一)

阅读提示&#xff1a; 1.文章大约10000多字&#xff0c;文章内容硬核&#xff0c;需要你集中注意力&#xff0c;不建议碎片化阅读&#xff0c;请预留出30分钟的整块时间。 2.本文是一套完整的知识体系&#xff0c;文章不会上来就直接扔你一个解决方案&#xff0c;而是会从『是…

ChatGPT实现语义分析情感分类

语义分析情感分类 我们从开源社区找到了中科院谭松波博士整理的携程网酒店评论数据集(https://raw.githubusercontent.com/SophonPlus/ChineseNlpCorpus/master/datasets/ChnSentiCorp_htl_all/ChnSentiCorp_htl_all.csv)。一共七千余条数据&#xff0c;包括 label 和 review …

GPT4和Claude100k测试使用

总述 程序员们通常使用大量代码&#xff0c;找到一个能够使用Claude100k和GPT4的&#xff0c;长代码优化有希望啦&#xff01; Liaobots&#xff1a;支持GPT4和Claude100k 不定期供应GPT4 32k&#xff0c;支持最多24000字符请求 大家有时候会觉得GPT4 8k不够用&#xff0c;…