Exemple #1
0
func init() {
	//
	colour = [max]col.Colour{col.LightCyan, col.LightYellow, col.Pink, col.LightGreen,
		col.LightWhite, col.Orange, col.LightBlue, col.Yellow,
		col.LightGreen, col.LightRed, col.LightMagenta, col.LightOrange}
	notUsedColour = col.DarkGray
	image = [max + 1]string{"Anaxagoras", "Aristoteles", "Cicero", "Demokrit",
		"Diogenes", "Epikur", "Heraklit", "Platon",
		"Protagoras", "Pythagoras", "Sokrates", "Thales",
		"Niemand"}
	for n := 0; n <= max; n++ {
		image[n] = env.Val("GOSRC") + "/murus/phil/pics/" + image[n]
	}
	const zweipi = float64(2 * math.Pi)
	text = [nStatuses]string{"    satt    ", "  hungrig   ", "sehr hungrig",
		"sehr hungrig", "sehr hungrig", "  speisend  "}
	thinkColour = col.ScreenB
	/*
	   if p > 6 {
	     if scr.UnderX () {
	       scr.Fullscreen()
	     }
	   }
	*/
	x0, y0 = scr.NX()/2, scr.NY()/2
	const f = float64(0.5)
	for p := uint(0); p < nPhilos; p++ {
		// Attention: the mathematical positiv sense is inverted on the scr, because lines count upwards !
		// middlepoint of plates:
		w, r := float64(p)/float64(nPhilos), 0.75*float64(y0)
		xt[p] = int(math.Trunc(r*math.Cos(zweipi*w)+f)) + int(x0)
		yt[p] = int(math.Trunc(-r*math.Sin(zweipi*w)+f)) + int(y0)
		// endpoints of the fork to the right (with the same number):
		w, r = w+0.5/float64(nPhilos), float64(y0)
		x[p] = int(math.Trunc(r*math.Cos(zweipi*w)+f)) + int(x0)
		y[p] = int(math.Trunc(-r*math.Sin(zweipi*w)+f)) + int(y0)
		r = r / 2.0
		x1[p] = int(math.Trunc(r*math.Cos(zweipi*w)+f)) + int(x0)
		y1[p] = int(math.Trunc(-r*math.Sin(zweipi*w)+f)) + int(y0)
		//    stat[p] = hungry
	}
}
Exemple #2
0
func Far() bool {
	//
	return env.Val(_DISPLAY)[0] == 'l' // localhost
}
Exemple #3
0
func Active() bool {
	//
	dspl = env.Val(_DISPLAY)
	return dspl != ""
}