java编写简单的小游戏(纯粹:练习基础)

一,俄罗斯方块。
话不多说。先看源码。这是一个最基础的Javaweb工程编写的。有何不对的多多指教。。。


1.。。。Model import java.util.ArrayList;public class Modle {private ArrayList<Node> modle = new ArrayList<Node>();private int dir = DOWN;private int type = 0; // 每种模型的可变换类型的标记private char style; // 模式共7种private boolean isMoved = true; // 是否可以移动/** ooo o o oo o o type=0 type=1 ...*/public static final int UP = -1;public static final int DOWN = 1;public static final int LEFT = -10;public static final int RIGHT = 10;// 格子的宽度public static final int WIDTH = 20;public Modle() {super();}// 构建6种形式的模型public Modle(int type) {switch (type) {case 0:// oooogetModle().add(new Node(-2 * WIDTH, 0));getModle().add(new Node(-WIDTH, 0));getModle().add(new Node(0, 0));getModle().add(new Node(WIDTH, 0));moveCenter();// type = 0;style = '-';break;case 1:// ooo// ogetModle().add(new Node(-WIDTH, -WIDTH));getModle().add(new Node(0, -WIDTH));getModle().add(new Node(WIDTH, -WIDTH));getModle().add(new Node(0, 0));moveCenter();style = 'T';break;case 2:// oo// oogetModle().add(new Node(-WIDTH, -WIDTH));getModle().add(new Node(0, -WIDTH));getModle().add(new Node(-WIDTH, 0));getModle().add(new Node(0, 0));moveCenter();style = '口';break;case 3:// oo// oogetModle().add(new Node(-WIDTH, -WIDTH));getModle().add(new Node(0, -WIDTH));getModle().add(new Node(0, 0));getModle().add(new Node(WIDTH, 0));moveCenter();style = 'Z';break;case 4:// oo// o// ogetModle().add(new Node(WIDTH, -2 * WIDTH));getModle().add(new Node(0, -2 * WIDTH));getModle().add(new Node(0, -WIDTH));getModle().add(new Node(0, 0));moveCenter();style = 'F';break;case 5:// oo// o// ogetModle().add(new Node(-WIDTH, -2 * WIDTH));getModle().add(new Node(0, -2 * WIDTH));getModle().add(new Node(0, -WIDTH));getModle().add(new Node(0, 0));moveCenter();style = '7';break;case 6:// oo// oogetModle().add(new Node(-WIDTH, 0));getModle().add(new Node(0, 0));getModle().add(new Node(0, -WIDTH));getModle().add(new Node(WIDTH, -WIDTH));moveCenter();style = 'S';break;default:break;}}// 将构造的Modle移动到面板中间private void moveCenter() {for (int i = 0; i < getModle().size(); i++) {Node n = getModle().get(i);n.setX(n.getX() + TetrisDemo.WIDTH / 2);n.setY(n.getY() - 10);}}// 将模型移动到指定位置public void moveCenter(Node node) {for (int i = 0; i < getModle().size(); i++) {Node n = getModle().get(i);// System.out.println("1 " + n);n.setX(n.getX() + node.getX() - TetrisDemo.WIDTH / 2);n.setY(n.getY() + node.getY() + 10);// System.out.println("2  " + n);}}public void moveBack(Node node) {for (int i = 0; i < getModle().size(); i++) {Node n = getModle().get(i);// System.out.println("1 " + n);n.setX(n.getX() - node.getX() + TetrisDemo.WIDTH / 2);n.setY(n.getY() - node.getY() - 10);// System.out.println("2  " + n);}}public ArrayList<Node> getModel() {return getModle();}// 按默认方向走一步public synchronized void step() {for (Node n : getModle()) {n.setX(n.getX() + dir / 10 * WIDTH);n.setY(n.getY() + dir % 10 * WIDTH);}this.dir = DOWN;}// 按dir方向走一步public synchronized void step(int dir, Modle fixedModle) {if (getModle() == null) {return;}if (fixedModle == null) {for (Node n : getModle()) {int x = n.getX() + dir / 10 * WIDTH;int y = n.getY() + dir % 10 * WIDTH;if (x >= TetrisDemo.WIDTH - TetrisDemo.WIDTH / 4|| x < TetrisDemo.WIDTH / 4 || y < -50) {this.dir = DOWN;return;}if (y > TetrisDemo.HIGHT - 50) {setMoved(false);this.dir = DOWN;return;}}}for (Node n : getModle()) {int x = n.getX() + dir / 10 * WIDTH;int y = n.getY() + dir % 10 * WIDTH;if (fixedModle.contains(new Node(x, y))) {if (dir != DOWN) {return;}setMoved(false);return;}if (x >= TetrisDemo.WIDTH - TetrisDemo.WIDTH / 4|| x < TetrisDemo.WIDTH / 4 || y < -50) {this.dir = DOWN;return;}if (y > TetrisDemo.HIGHT - 50) {setMoved(false);this.dir = DOWN;return;}}this.dir = dir;step();}// 将不能移动的modle添加到fixedNoespublic void add(Modle modle) {if (modle == null) {return;}for (Node m : modle.getModel()) {getModel().add(m);}}// 当前modle是否包含节点nodepublic boolean contains(Node node) {if (node == null) {return false;}for (Node n : getModle()) {if (n.equals(node)) {return true;}}return false;}// 检查节点是否在Modle内,是否在面板内public boolean checked(Node node) {int x = node.getX();int y = node.getY();if (x >= TetrisDemo.WIDTH - TetrisDemo.WIDTH / 4|| x < TetrisDemo.WIDTH / 4 || y < -50|| y > TetrisDemo.HIGHT - 50) {return false;}if (contains(node)) {return false;}return true;}// 模型的转换public synchronized void turn(Modle fixedNode) {Modle m = fixedNode;if (modle.size() != 4) {this.dir = 0;return;}int x2 = modle.get(1).getX();int x3 = modle.get(2).getX();int x4 = modle.get(3).getX();int y2 = modle.get(1).getY();int y3 = modle.get(2).getY();int y4 = modle.get(3).getY();if (style == ('-')) {switch (type) {case 0:// System.out.println("1  " + modle);if (m.checked(new Node(x3, y3 - (2 * WIDTH)))&& m.checked(new Node(x3, y3 - WIDTH))&& m.checked(new Node(x3, y3 + WIDTH))) {modle.set(0, new Node(x3, y3 - (2 * WIDTH)));modle.set(1, new Node(x3, y3 - WIDTH));modle.set(3, new Node(x3, y3 + WIDTH));this.type = 1;}// System.out.println("2  " + modle);break;case 1:// System.out.println("3  " + modle);if (m.checked(new Node(x3 - 2 * WIDTH, y3))&& m.checked(new Node(x3 - WIDTH, y3))&& m.checked(new Node(x3 + WIDTH, y3))) {modle.set(0, new Node(x3 - 2 * WIDTH, y3));modle.set(1, new Node(x3 - WIDTH, y3));modle.set(3, new Node(x3 + WIDTH, y3));this.type = 0;}// System.out.println("4  " + modle);break;default:break;}}if (style == ('T')) {switch (type) {case 0:if (m.checked(new Node(x2, y2 - WIDTH))) {modle.set(0, new Node(x2, y2 - WIDTH));this.type = 1;}break;case 1:if (m.checked(new Node(x2 - WIDTH, y2))) {modle.set(3, new Node(x2 - WIDTH, y2));type = 2;}break;case 2:if (m.checked(new Node(x2, y2 + WIDTH))) {modle.set(2, new Node(x2, y2 + WIDTH));type = 3;}break;case 3:if (m.checked(new Node(x4, y4))&& m.checked(new Node(x2 + WIDTH, y2))&& m.checked(new Node(x3, y3))) {modle.set(0, new Node(x4, y4));modle.set(2, new Node(x2 + WIDTH, y2));modle.set(3, new Node(x3, y3));type = 0;}break;default:break;}}if (style == ('口')) {this.dir = 0;return;}if (style == ('Z')) {switch (type) {case 0:if (m.checked(new Node(x4, y4 - 2 * WIDTH))&& m.checked(new Node(x4, y4 - WIDTH))&& m.checked(new Node(x4, y4 - WIDTH))) {modle.set(0, new Node(x4, y4 - 2 * WIDTH));modle.set(3, new Node(x4, y4 - WIDTH));type = 1;}break;case 1:if (m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x4, y4 + WIDTH))) {modle.set(0, new Node(x2 - WIDTH, y2));modle.set(3, new Node(x4, y4 + WIDTH));type = 0;}break;default:break;}}if (style == 'F') {switch (type) {case 0:if (m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x2 + WIDTH, y2))&& m.checked(new Node(x2 - WIDTH, y2 - WIDTH))) {modle.set(0, new Node(x2 - WIDTH, y2));modle.set(2, new Node(x2 + WIDTH, y2));modle.set(3, new Node(x2 - WIDTH, y2 - WIDTH));type = 1;}break;case 1:if (m.checked(new Node(x2, y2 + WIDTH))&& m.checked(new Node(x2, y2 - WIDTH))&& m.checked(new Node(x2 - WIDTH, y2 + WIDTH))) {modle.set(0, new Node(x2, y2 + WIDTH));modle.set(2, new Node(x2, y2 - WIDTH));modle.set(3, new Node(x2 - WIDTH, y2 + WIDTH));type = 2;}break;case 2:if (m.checked(new Node(x2 + WIDTH, y2))&& m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x2 + WIDTH, y2 + WIDTH))) {modle.set(0, new Node(x2 + WIDTH, y2));modle.set(2, new Node(x2 - WIDTH, y2));modle.set(3, new Node(x2 + WIDTH, y2 + WIDTH));type = 3;}break;case 3:if (m.checked(new Node(x2, y2 - WIDTH))&& m.checked(new Node(x2, y2 + WIDTH))&& m.checked(new Node(x2 + WIDTH, y2 - WIDTH))) {modle.set(0, new Node(x2, y2 - WIDTH));modle.set(2, new Node(x2, y2 + WIDTH));modle.set(3, new Node(x2 + WIDTH, y2 - WIDTH));type = 0;}break;default:break;}}if (style == '7') {switch (type) {case 0:if (m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x2 + WIDTH, y2))&& m.checked(new Node(x2 - WIDTH, y2 + WIDTH))) {modle.set(0, new Node(x2 - WIDTH, y2));modle.set(2, new Node(x2 + WIDTH, y2));modle.set(3, new Node(x2 - WIDTH, y2 + WIDTH));type = 1;}break;case 1:if (m.checked(new Node(x2, y2 + WIDTH))&& m.checked(new Node(x2, y2 - WIDTH))&& m.checked(new Node(x2 + WIDTH, y2 + WIDTH))) {modle.set(0, new Node(x2, y2 + WIDTH));modle.set(2, new Node(x2, y2 - WIDTH));modle.set(3, new Node(x2 + WIDTH, y2 + WIDTH));type = 2;}break;case 2:if (m.checked(new Node(x2 + WIDTH, y2))&& m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x2 + WIDTH, y2 - WIDTH))) {modle.set(0, new Node(x2 + WIDTH, y2));modle.set(2, new Node(x2 - WIDTH, y2));modle.set(3, new Node(x2 + WIDTH, y2 - WIDTH));type = 3;}break;case 3:if (m.checked(new Node(x2, y2 - WIDTH))&& m.checked(new Node(x2, y2 + WIDTH))&& m.checked(new Node(x2 - WIDTH, y2 - WIDTH))) {modle.set(0, new Node(x2, y2 - WIDTH));modle.set(2, new Node(x2, y2 + WIDTH));modle.set(3, new Node(x2 - WIDTH, y2 - WIDTH));type = 0;}break;default:break;}}if (style == 'S') {switch (type) {case 0:if (m.checked(new Node(x2, y2 + WIDTH))&& m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x2 - WIDTH, y2 - WIDTH))) {modle.set(0, new Node(x2, y2 + WIDTH));modle.set(2, new Node(x2 - WIDTH, y2));modle.set(3, new Node(x2 - WIDTH, y2 - WIDTH));type = 1;}break;case 1:if (m.checked(new Node(x2 - WIDTH, y2))&& m.checked(new Node(x2, y2 - WIDTH))&& m.checked(new Node(x2 + WIDTH, y2 - WIDTH))) {modle.set(0, new Node(x2 - WIDTH, y2));modle.set(2, new Node(x2, y2 - WIDTH));modle.set(3, new Node(x2 + WIDTH, y2 - WIDTH));type = 0;}break;default:break;}}this.dir = 0;return;}public boolean isMoved() {return isMoved;}public void setMoved(boolean isMoved) {this.isMoved = isMoved;}public int getDir() {return dir;}public void setDir(int dir) {this.dir = dir;}public int getType() {return type;}public void setType(int type) {this.type = type;}public char getStyle() {return style;}public void setStyle(char style) {this.style = style;}@Overridepublic String toString() {return "Modle [model=" + getModle().toString() + ", dir=" + dir+ ", isMoved=" + isMoved + "]";}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + dir;result = prime * result + (isMoved ? 1231 : 1237);result = prime * result+ ((getModle() == null) ? 0 : getModle().hashCode());return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;Modle other = (Modle) obj;if (dir != other.dir)return false;if (isMoved != other.isMoved)return false;if (getModle() == null) {if (other.getModle() != null)return false;} else if (!getModle().equals(other.getModle()))return false;return true;}public ArrayList<Node> getModle() {return modle;}public void setModle(ArrayList<Node> modle) {this.modle = modle;}
}
2.。。。。Node/** 节点:用于组成方块的位置* x:横坐标* y:纵坐标**/
public class Node {private int x;private int y;public Node() {}public Node(int x, int y) {super();this.x = x;this.y = y;}public int getX() {return x;}public void setX(int x) {this.x = x;}public int getY() {return y;}public void setY(int y) {this.y = y;}@Overridepublic String toString() {return "Node [x=" + x + ", y=" + y + "]";}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + x;result = prime * result + y;return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;Node other = (Node) obj;if (x != other.x)return false;if (y != other.y)return false;return true;}}
3.。。。TetrisDemoimport javax.swing.JFrame;public class TetrisDemo extends JFrame{private TetrisPanel panel;public static final int WIDTH = 800;public static final int HIGHT = 600;public TetrisDemo() {panel = new TetrisPanel();setTitle("俄罗斯方块");add(panel);setContentPane(panel);setSize(WIDTH, HIGHT);setVisible(true);setResizable(false);panel.requestFocus();setLocationRelativeTo(null);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public static void main(String[] args) {TetrisDemo frame = new TetrisDemo();}
}
4.。。。TetrisPanelimport java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;import javax.swing.JPanel;public class TetrisPanel extends JPanel {private Modle modle;private Modle fixedNode = new Modle();private int score = 0;private MoveListener m = new MoveListener();private Service s = new Service();Random random = new Random();private Modle next;public TetrisPanel() {modle = new Modle(random.nextInt(7));// modle = new Modle(0);addKeyListener(m);fixedNode.setMoved(false);s.start();}public void paint(Graphics g) {super.paint(g);// 黑边g.setColor(Color.black);g.fill3DRect(0, 0, TetrisDemo.WIDTH / 4, TetrisDemo.HIGHT, false);g.fill3DRect(TetrisDemo.WIDTH - TetrisDemo.WIDTH / 4, 0,TetrisDemo.WIDTH / 4, TetrisDemo.HIGHT, false);// 画提示线g.setColor(Color.pink);g.drawLine(TetrisDemo.WIDTH / 4 + 1, 0, TetrisDemo.WIDTH / 4 + 1,TetrisDemo.HIGHT);for (int i = TetrisDemo.WIDTH / 4; i <= TetrisDemo.WIDTH * 3 / 4; i++) {if (i % Modle.WIDTH == 0) {g.drawLine(i, 0, i, TetrisDemo.HIGHT);}}// 分数g.setColor(Color.blue);g.setFont(new Font(TOOL_TIP_TEXT_KEY, ERROR, 20));g.drawString("您的分数是:", 50, 180);g.clearRect(50, 200, TetrisDemo.WIDTH / 8, 50);g.setColor(Color.red);score = getScore();// System.out.println("分数 == " + score);g.drawString("" + score, 70, 230);// 下一个上一个// 下一个g.setColor(Color.blue);g.setFont(new Font(TOOL_TIP_TEXT_KEY, ERROR, 20));g.drawString("下一个:", TetrisDemo.WIDTH * 3 / 4 + 50,TetrisDemo.HIGHT / 2 - 200);g.clearRect(TetrisDemo.WIDTH * 3 / 4 + 60 - Modle.WIDTH,130 - Modle.WIDTH, TetrisDemo.WIDTH / 8 + 2 * Modle.WIDTH,100 + 2 * Modle.WIDTH);// 不能移动的模型放到集合fixedNode中if (!modle.isMoved()) {fixedNode.add(modle);modle = clone(next);next = new Modle(random.nextInt(7));// next = new Modle(0);next.setMoved(false);next.moveCenter(new Node(TetrisDemo.WIDTH * 3 / 4 + 100, 185));// System.out.println("next  " + next);// 随机产生一个模型}if (next == null) {next = new Modle(random.nextInt(7));// next = new Modle(0);next.moveCenter(new Node(TetrisDemo.WIDTH * 3 / 4 + 100, 185));next.setMoved(false);}g.setColor(Color.orange);paintModle(next, g);// 当前g.setColor(Color.red);g.drawString("当  前:", TetrisDemo.WIDTH * 3 / 4 + 50,TetrisDemo.HIGHT / 2);g.clearRect(TetrisDemo.WIDTH * 3 / 4 + 50 - Modle.WIDTH,200 + 130 - Modle.WIDTH,TetrisDemo.WIDTH / 8 + 2 * Modle.WIDTH, 100 + 2 * Modle.WIDTH);// 构造当前模型Modle current = clone(modle);// System.out.println("current  == " + current);// System.out.println("node = " + new Node(TetrisDemo.WIDTH * 3 / 4 +// 50, 200 + 130));current.moveCenter(new Node(TetrisDemo.WIDTH * 3 / 4 + 90, 200 + 185));g.setColor(Color.green);paintModle(current, g);// 画可移动模型// System.out.println("将要画的modle = " + modle);
//      g.setColor(Color.green);
//      for (Node n : modle.getModel()) {
//          if (fixedNode.contains(n)) {
//              s.stop();
//              paintEnd(g);
//              return;
//          }paintModle(modle, g);
//      }// 画不可移动模型// System.out.println("将要画的fixedNode的长度 = " +// fixedNode.getModel().size());g.setColor(Color.cyan);paintModle(fixedNode, g);}// 结束界面public void paintEnd(Graphics g) {g.setColor(Color.red);g.setFont(new Font(TOOL_TIP_TEXT_KEY, ERROR, 30));g.clearRect(0, 150, 550, 100);g.setColor(Color.BLUE);g.fillRect(0, 150, 550, 100);g.clearRect(150, 180, 200, 40);g.setColor(Color.red);g.drawString(" Game  Over!", 150, 210);Service.interrupted();// removeKeyListener(listener);}// 复制模型mpublic Modle clone(Modle m) {if (m == null) {return null;}Modle current = new Modle();char[] chars = new char[] { '-', 'T', '口', 'Z', 'F', '7', 'S' };for (int i = 0; i < chars.length; i++) {char c = chars[i];if (m.getStyle() == c) {current = new Modle(i);break;}}return current;}// 计算分数public int getScore() {// 填充满的行数int line = 0;if (fixedNode == null) {return score;}// 将fixNode中Node的y统计出现的次数map<y ,次数>Map<Integer, Integer> map = new HashMap<Integer, Integer>();for (Node n : fixedNode.getModel()) {int y = n.getY();int count = 1;if (map.keySet().contains(y)) {count = map.get(y) + 1;map.put(y, count);continue;}map.put(y, 1);}// 迭代y 删除每行不够20个格子Iterator<Entry<Integer, Integer>> ite = map.entrySet().iterator();while (ite.hasNext()) {int key = ite.next().getKey();int count = map.get(key);// System.out.println("key : value = " + key + ":" + count);if (count == 20) {line++;map.put(key, 0);continue;}ite.remove();}// 迭代fixedNode 并修改需要移动行数countdeleteLine(fixedNode, map.keySet());TetrisPanel.this.repaint();return line * 10 + score;}public void deleteLine(Modle m, Set<Integer> yy) {ArrayList<Node> nodes = m.getModel();Iterator<Integer> i = yy.iterator();while (i.hasNext()) {int y = i.next();Iterator<Node> nod = nodes.iterator();while (nod.hasNext()) {Node n = nod.next();if (y == n.getY()) {nod.remove();continue;}if (n.getY() < y) {n.setY(n.getY() + Modle.WIDTH);}}}}// 画模型public void paintModle(Modle m, Graphics g) {if (m == null) {return;}// g.setColor(Color.cyan);for (Node n : m.getModel()) {g.fill3DRect(n.getX(), n.getY(), Modle.WIDTH, Modle.WIDTH, false);}}// 监听器class MoveListener extends KeyAdapter {int dir;public void keyPressed(KeyEvent e) {switch (e.getKeyCode()) {case KeyEvent.VK_UP:// Modle mod = modle;modle.setDir(0);// System.out.println("start  " + modle);modle.turn(fixedNode);// System.out.println("end   " + modle);modle.setDir(0);break;case KeyEvent.VK_DOWN:dir = Modle.DOWN;break;case KeyEvent.VK_LEFT:dir = Modle.LEFT;break;case KeyEvent.VK_RIGHT:dir = Modle.RIGHT;break;default:break;}// System.out.println("你按下的是:  " + e.getKeyChar());// System.out.println("dir = " + dir);// System.out.println("当前模型 = " + modle);// System.out.println("判断 " + modle);if (modle.isMoved() && modle.getDir() != 0) {modle.step(dir, fixedNode);// System.out.println("移动后的模型 = " + modle);}modle.setDir(Modle.DOWN);// System.out.println("重绘之前  " + modle);TetrisPanel.this.repaint();}}// 移动线程class Service extends Thread {public void run() {while (true) {try {Thread.sleep(500);if (modle.isMoved() && modle.getDir() != 0) {modle.step(Modle.DOWN, fixedNode);}// System.out.println(modle.getModel());TetrisPanel.this.repaint();} catch (InterruptedException e) {e.printStackTrace();}}}}public Modle modle() {return modle;}}

最简单的一个Java俄罗斯就实现了,多多指点。。。

一个javaweb基础的小游戏。。俄罗斯方块。。。相关推荐

  1. 鸿蒙小游戏-俄罗斯方块

    作者:225王宗振 前言 为了更好地熟练掌握鸿蒙手机应用开发,查阅资料和算法尝试开发鸿蒙小游戏--俄罗斯方块. 概述 完成鸿蒙小游戏APP在手机上的编译在项目中所使用到的软件为DevEco Studi ...

  2. Unity 游戏实例开发集合 之 CompoundBigWatermelon (简单合成一个大西瓜) 休闲小游戏快速实现

    Unity 游戏实例开发集合 之 CompoundBigWatermelon (简单合成一个大西瓜) 休闲小游戏快速实现 目录 Unity 游戏实例开发集合 之 CompoundBigWatermel ...

  3. 掉进悬崖的小白,捡到python基础秘籍,学习第一周——语法基础,小游戏,无脑循环

    掉进悬崖的小白,捡到python基础秘籍,学习第一周--语法基础,小游戏,无脑循环 人生苦短,我用python 语言的种类: 语言的发展: 什么是python 搭建 Python开发环境: 集成开发环 ...

  4. 做一个简单的java小游戏--单机版五子棋

    做一个简单的java小游戏–单机版五子棋 学了java有一段时间了,今天就来搞一个简单的单机版五子棋游戏. 实现功能:那必须能进行基础的输赢判断.还有重新开始的功能,悔棋的功能,先手设置的功能和退出的 ...

  5. python tkinter火柴人_用Python实现童年小游戏俄罗斯方块!别说还挺好玩!

    原标题:用Python实现童年小游戏俄罗斯方块!别说还挺好玩! 前言 大三上学期的程序设计实训大作业,挑了其中一个我认为最简单的的<图书管理系统>来写.用python写是因为py有自带的G ...

  6. [SFML]使用SFML复刻一个九宫幻卡小游戏(一)前期规划和准备工作

    写在前面:   是笔者大二下的课内作业,要求是使用SFML制作棋牌类游戏.本人水平较差,复刻开发过程中存在大量走弯路.走邪门.代码冗余等情况.写此博客记录已经是一年以后的复盘了,仅作为个人学习的记录. ...

  7. python井字棋_用Python做一个井字棋小游戏

    井字棋是一个经典的小游戏,在九宫格上玩家轮流画OXO,当每列或每行或是两个对角成一线时便是获胜. 今天就用Python编写一个井字棋小游戏,与电脑对战. 程序执行画面如下图所示: 程序提供了两种人工智 ...

  8. python简单小游戏代码_一个简单的python小游戏---七彩同心圆

    本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理 用pygame做一个简单的python小游戏-七彩同心圆 玩法:每次点击鼠标时,会以鼠标为圆心,不断 ...

  9. python井字棋游戏人机对战_用Python做一个井字棋小游戏

    井字棋是一个经典的小游戏,在九宫格上玩家轮流画OXO,当每列或每行或是两个对角成一线时便是获胜. 今天就用Python编写一个井字棋小游戏,与电脑对战. 程序执行画面如下图所示: 程序提供了两种人工智 ...

最新文章

  1. 【Go】Go基础(七):包
  2. 如何用matlab读取npz文件,Python Numpy中数据的常用的保存与读取方法
  3. FPGA笔试题解析(三)
  4. c#中获取控件窗体句柄,获取窗体等的一些操作
  5. SQL注入学习资料总结
  6. 华为突遭 Google 釜底抽薪,国产自研操作系统生态恐不可承其重!
  7. 前端智勇大闯关-第二季-第三题
  8. jsp 引入java类库报错_myeclipse中运行Jsp项目调用java,运行不了,报错说不能解析jsp中的类型,资源文件无法使用,求解,...
  9. 产品 电信nb接口调用_NB-IoT 平台对接常见问题(中国电信)
  10. python 英语词典下载_Python 字典(Dictionary)
  11. 博主自我介绍、当前已经成立的技术分局【专栏必读】
  12. 三星s8怎么分屏操作_三星Galaxy Z Fold2帮你应对快节奏生活
  13. 基于.net的当下传统制造业MES系统的思考(一)
  14. 基于博客系统的访客日志记录----代码合集
  15. 使用Arduino Tone()函数演奏旋律
  16. 全球与中国厂内物流自动化市场深度研究分析报告
  17. 山西应用科技学院计算机应用在哪个校区,山西应用科技学院有几个校区,哪个校区最好及各校区介绍...
  18. 新数据时代存储怎么卖,浪潮存储有高招!
  19. 10进制转37进制c语言程序,十进制数37转换成二进制数是( )。A.(100001)2B.(100101)2C.(101001)2D.(110001)2_考题宝...
  20. Asp.net的GridView控件实现单元格可编辑

热门文章

  1. his使用-重置密码
  2. Python随机生成出生日期
  3. Redis 基础 - 优惠券秒杀《初步优化(异步秒杀)》
  4. (数据库系统)(十一)并发控制
  5. 免费手机邮箱,WAP客掌上邮
  6. 标准正态分布变量的累积概率分布函数
  7. 澳门W.B.C开启世界区块链“峰会+嘉年华+学院+全球行”新模式
  8. CLOSE关闭连接的各种情况
  9. 实例化和初始化的区别
  10. uni-app checkbox和switch组件checked属性无效的解决方案