boren -博仁版社会游戏

# 条形图  bar 柱子
# 条形图  bar 柱子
import matplotlib.pyplot as plt
import random
plt.rcParams['font.sans-serif'] = ['SimHei']
# 生产数据:
# 数据类型:数字,"字符串",["列表",100,123],{"键值":"对"},(元组), 布尔表达式
num = 500
money = [100]*num
ren = []  # 人的序号
# 抱树
for i in range(num ):
    ren.append(i)
print(money)
print(ren)
ax = plt.subplot(111) # 设置画布de位置,三个数字分别表示第一行第一列第一张图
jin_bi = 10
for q in range(1000):
    for i in range(num ):
        # 每个人都要减少一块钱
        money[i]=money[i]-jin_bi
        # 随机100个人加一块钱
        a= random.randint(0,num-1)
        money[a]=money[a]+jin_bi

    ax.cla() # 清除画面
    plt.title("第%d次分钱,最小身价%d,最大身价%d"%(q,min(money),max(money)))
    plt.bar(ren,money,color=["#1E90FF","#FF6A6A"],alpha=0.8) # 透明度 0-1
    plt.xlabel("人员序号")
    plt.ylabel("人员身价")
    plt.pause(0.1) # 暂停时间


# rgb

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
/* * File: ADC.c * Author: tlfte *AD转换,结果在C口和D口的LED上显示,能进行各种通道选择和参考电压,结果对齐方式选择 * Created on 2018年8月6日, 上午10:07 练习AD结果的计算验证,AD_RESULT=VIN×1023÷VREF,讲解887头文件的作用 */ // PIC16F887 Configuration Bit Settings // 'C' source line config statements // CONFIG1 #pragma config FOSC = XT // Oscillator Selection bits (XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // RE3/MCLR pin function select bit (RE3/MCLR pin function is digital input, MCLR internally tied to VDD) #pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled) #pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled) #pragma config BOREN = OFF // Brown Out Reset Selection bits (BOR disabled) #pragma config IESO = OFF // Internal External Switchover bit (Internal/External Switchover mode is disabled) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled) #pragma config LVP = OFF // Low Voltage Programming Enable bit (RB3 pin has digital I/O, HV on MCLR must be used for programming) // CONFIG2 #pragma config BOR4V = BOR40V // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V) #pragma config WRT = OFF // Flash Program Memory Self Write Enable bits (Write protection off) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include <xc.h> #define _XTAL_FREQ 4000000 //指明时钟晶振为4MHz,使delay宏定义可以正常使用 void CSH(void); unsigned int AD_SUB(char k); void main( ) { unsigned int y; CSH(); while(1) { __delay_ms(100); //每隔100毫秒循环一次 y=AD_
最新发布
05-24

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值